• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

badges / shields / 9903979652

11 Jul 2024 05:45PM UTC coverage: 94.88% (-1.7%) from 96.56%
9903979652

push

github

web-flow
Add code coverage action (#10340)

* Add code coverage action

* Run on Node 22

* Separate service tests out

* Temporarily run on all pushes to test out

* Switch to daily schedule

6292 of 6553 branches covered (96.02%)

47370 of 49926 relevant lines covered (94.88%)

116.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.83
/services/github/github-watchers.service.js
1
import Joi from 'joi'
1✔
2
import { pathParams } from '../index.js'
1✔
3
import { metric } from '../text-formatters.js'
1✔
4
import { nonNegativeInteger } from '../validators.js'
1✔
5
import { GithubAuthV3Service } from './github-auth-service.js'
1✔
6
import { documentation, httpErrorsFor } from './github-helpers.js'
1✔
7

1✔
8
const schema = Joi.object({
1✔
9
  subscribers_count: nonNegativeInteger,
1✔
10
}).required()
1✔
11

1✔
12
export default class GithubWatchers extends GithubAuthV3Service {
1✔
13
  static category = 'social'
3✔
14

3✔
15
  static route = {
3✔
16
    base: 'github/watchers',
3✔
17
    pattern: ':user/:repo',
3✔
18
  }
×
19

×
20
  static openApi = {
×
21
    '/github/watchers/{user}/{repo}': {
3✔
22
      get: {
3✔
23
        summary: 'GitHub watchers',
3✔
24
        description: documentation,
3✔
25
        parameters: pathParams(
3✔
26
          { name: 'user', example: 'badges' },
3✔
27
          { name: 'repo', example: 'shields' },
3✔
28
        ),
3✔
29
      },
3✔
30
    },
3✔
31
  }
3✔
32

3✔
33
  static defaultBadgeData = {
3✔
34
    label: 'watchers',
3✔
35
    namedLogo: 'github',
3✔
36
  }
3✔
37

3✔
38
  static render({ watchers, user, repo }) {
3✔
39
    return {
1✔
40
      message: metric(watchers),
1✔
41
      style: 'social',
1✔
42
      color: 'blue',
1✔
43
      link: [
1✔
44
        `https://github.com/${user}/${repo}`,
1✔
45
        `https://github.com/${user}/${repo}/watchers`,
1✔
46
      ],
1✔
47
    }
1✔
48
  }
1✔
49

3✔
50
  async handle({ user, repo }) {
3✔
51
    const { subscribers_count: watchers } = await this._requestJson({
2✔
52
      url: `/repos/${user}/${repo}`,
2✔
53
      schema,
2✔
54
      httpErrors: httpErrorsFor(),
2✔
55
    })
2✔
56
    return this.constructor.render({ user, repo, watchers })
1✔
57
  }
2✔
58
}
3✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc