Skip to content

Commit ac127f6

Browse files
committed
feat: add support for code coverage shield
1 parent 05beccf commit ac127f6

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

Diff for: README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# code-server · [!["GitHub Discussions"](https://img.shields.io/badge/%20GitHub-%20Discussions-gray.svg?longCache=true&logo=github&colorB=purple)](https://github.com/cdr/code-server/discussions) [!["Join us on Slack"](https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=brightgreen)](https://cdr.co/join-community) [![Twitter Follow](https://img.shields.io/twitter/follow/CoderHQ?label=%40CoderHQ&style=social)](https://twitter.com/coderhq)
22

3+
![Lines](https://img.shields.io/badge/Coverage-46.71%25-green.svg)
4+
35
Run [VS Code](https://github.com/Microsoft/vscode) on any machine anywhere and access it in the browser.
46

57
![Screenshot](./doc/assets/screenshot.png)

Diff for: ci/README.md

+14
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Make sure you have `$GITHUB_TOKEN` set and [hub](https://github.com/github/hub)
2121
- Remember to update the chart version as well on top of appVersion in `Chart.yaml`.
2222
- Run `rg -g '!yarn.lock' -g '!*.svg' '3\.7\.5'` to ensure all values have been
2323
changed. Replace the numbers as needed.
24+
4. Update the code coverage badge (see [here](#updating-code-coverage-in-readme) for instructions)
2425
2. GitHub actions will generate the `npm-package`, `release-packages` and `release-images` artifacts.
2526
1. You do not have to wait for these.
2627
3. Run `yarn release:github-draft` to create a GitHub draft release from the template with
@@ -43,6 +44,19 @@ Make sure you have `$GITHUB_TOKEN` set and [hub](https://github.com/github/hub)
4344
11. Update the homebrew package.
4445
- Send a pull request to [homebrew-core](https://github.com/Homebrew/homebrew-core) with the URL in the [formula](https://github.com/Homebrew/homebrew-core/blob/master/Formula/code-server.rb) updated.
4546

47+
## Updating Code Coverage in README
48+
49+
Currently, we run a command to manually generate the code coverage shield. Follow these steps:
50+
51+
1. Run `yarn badges`
52+
2. Go into the README and change the color from `red` to `green` in this line:
53+
54+
```
55+
![Lines](https://img.shields.io/badge/Coverage-46.71%25-red.svg)
56+
```
57+
58+
NOTE: we have to manually change the color because the default is red if coverage is less than 80. See code [here](https://github.com/olavoparno/istanbul-badges-readme/blob/develop/src/editor.ts#L24-L33).
59+
4660
## dev
4761

4862
This directory contains scripts used for the development of code-server.

Diff for: package.json

+10-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"test": "./ci/dev/test.sh",
2727
"ci": "./ci/dev/ci.sh",
2828
"watch": "VSCODE_IPC_HOOK_CLI= NODE_OPTIONS=--max_old_space_size=32384 ts-node ./ci/dev/watch.ts",
29-
"icons": "./ci/dev/gen_icons.sh"
29+
"icons": "./ci/dev/gen_icons.sh",
30+
"badges": "istanbul-badges-readme"
3031
},
3132
"main": "out/node/entry.js",
3233
"devDependencies": {
@@ -53,6 +54,7 @@
5354
"eslint-config-prettier": "^6.0.0",
5455
"eslint-plugin-import": "^2.18.2",
5556
"eslint-plugin-prettier": "^3.1.0",
57+
"istanbul-badges-readme": "^1.2.0",
5658
"leaked-handles": "^5.2.0",
5759
"parcel-bundler": "^1.12.4",
5860
"prettier": "^2.0.5",
@@ -124,10 +126,16 @@
124126
"coverageDirectory": "<rootDir>/coverage",
125127
"coverageReporters": [
126128
"json",
129+
"json-summary",
127130
"text"
128131
],
129132
"coveragePathIgnorePatterns": [
130133
"out"
131-
]
134+
],
135+
"coverageThreshold": {
136+
"global": {
137+
"lines": 40
138+
}
139+
}
132140
}
133141
}

Diff for: yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -4360,6 +4360,11 @@ isstream@~0.1.2:
43604360
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
43614361
integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=
43624362

4363+
istanbul-badges-readme@^1.2.0:
4364+
version "1.2.0"
4365+
resolved "https://registry.yarnpkg.com/istanbul-badges-readme/-/istanbul-badges-readme-1.2.0.tgz#f6dc226fb2ef498b1743ca15ae2dd82ccd3b0c28"
4366+
integrity sha512-7yU9tFbl7IsqlgfFF52G1fj7w2Z2k+UykVrCCIAQ8pnezZIIwxtAD079cIcqsbyCH7gCAALhiW3waHv9C24vrg==
4367+
43634368
js-tokens@^4.0.0:
43644369
version "4.0.0"
43654370
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"

0 commit comments

Comments
 (0)