Skip to content

Commit

Permalink
chore(tests): local codecov integration
Browse files Browse the repository at this point in the history
- https://codecov.io

Signed-off-by: Lexus Drumgold <[email protected]>
  • Loading branch information
unicornware committed Dec 15, 2022
1 parent 78404f5 commit 6bc2306
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 8 deletions.
1 change: 1 addition & 0 deletions .dictionary.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ardatan
bdougie
cefc
codecov
commitlintrc
dawidd
dedupe
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ yarn-error.log*
# ------------------------------------------------------------------------------
*.lcov
__tests__/report.json
codecov
coverage/
tsconfig.temp.json
vitest.config.*.timestamp-*.mjs
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"[dotenv]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
"[handlebars]": {
"editor.defaultFormatter": "Greenbyte.handlebars-preview",
"editor.rulers": [
Expand Down
41 changes: 33 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ Follow the steps below to setup your local development environment:

# LOAD ENVIRONMENT VARIABLES IN CURRENT WORKING DIRECTORY
# 1. $GITHUB_WORKSPACE
# 2. environment variables (local)
[ -d $PWD/.git ] && export GITHUB_WORKSPACE=$(git rev-parse --show-toplevel)
[ -f $PWD/.env.local ] && source $PWD/.env.local
```

9. Load `dotenv` plugin via `$ZDOTDIR/.zshrc`:
Expand All @@ -96,6 +98,7 @@ Follow the steps below to setup your local development environment:
| name |
| ----------------------- |
| `CI` |
| `CODECOV_TOKEN` |
| `NODE_ENV` |
| `NODE_NO_WARNINGS` |
| `NODE_OPTIONS` |
Expand Down Expand Up @@ -231,11 +234,31 @@ Be sure to use [`it.skip`][15] or [`it.todo`][16] where appropriate.
- `yarn test:cov`
- See terminal for coverage output

#### Code Coverage

Code coverage is reported using [Codecov][17].

To manually upload coverage reports:

1. Retrieve `CODECOV_TOKEN` from a maintainer

2. Add `CODECOV_TOKEN` to `.env.local`

3. Reload shell

```sh
exec $SHELL
```

4. Install the [Codecov Uploader][18]

5. Run `yarn codecov`

### Getting Help

If you need help, make note of any issues in their respective files in the form of a [JSDoc comment][12]. If you need
help with a test, don't forget to use [`it.skip`][15] and/or [`it.todo`][16]. Afterwards, [start a discussion in the
Q&A category][17].
Q&A category][19].

## Labels

Expand All @@ -257,7 +280,7 @@ If you haven't found a related open issue, or feel that a closed issue should be
A well-written issue

- contains a well-written summary of the bug, feature, or improvement
- contains a [minimal, reproducible example][18] (if applicable)
- contains a [minimal, reproducible example][20] (if applicable)
- includes links to related articles and documentation (if any)
- includes an emoji in the title :wink:

Expand Down Expand Up @@ -356,8 +379,8 @@ Before deploying, the following steps must be completed:
- delete the release branch
- on release publish, [publish workflow](.github/workflows/publish.yml) will fire
- if successful, the workflow will:
- publish package to [github package registry][19]
- publish package to [npm][20]
- publish package to [github package registry][21]
- publish package to [npm][22]
[1]: https://brew.sh
[2]:
Expand All @@ -376,7 +399,9 @@ Before deploying, the following steps must be completed:
[14]: https://vitest.dev
[15]: https://vitest.dev/api/#test-skip
[16]: https://vitest.dev/api/#test-todo
[17]: https://github.com/flex-development/pathe/discussions/new?category=q-a
[18]: https://stackoverflow.com/help/minimal-reproducible-example
[19]: https://github.com/features/packages
[20]: https://npmjs.com
[17]: https://codecov.io
[18]: https://docs.codecov.com/docs/codecov-uploader
[19]: https://github.com/flex-development/pathe/discussions/new?category=q-a
[20]: https://stackoverflow.com/help/minimal-reproducible-example
[21]: https://github.com/features/packages
[22]: https://npmjs.com
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"clean:modules": "trash ./.yarn/{cache,*.gz} ./node_modules",
"clean:pack": "trash ./*.tgz",
"clean:test": "yarn clean:coverage && trash ./__tests__/report.json",
"codecov": "yarn test:cov && yarn test:cov:upload",
"conventional-changelog": "node --loader=./loader.mjs ./node_modules/.bin/conventional-changelog -n ./changelog.config.cts",
"fix:cg": "yarn fix:format && yarn fix:lint",
"fix:dedupe": "yarn dedupe --strategy=highest",
Expand All @@ -69,6 +70,7 @@
"test": "vitest run",
"test:cov": "yarn clean:coverage; yarn test --coverage",
"test:cov:serve": "serve ./coverage/lcov-report",
"test:cov:upload": "./codecov -t $CODECOV_TOKEN -f ./coverage/lcov.info",
"test:watch": "vitest",
"typecheck": "vitest typecheck --run",
"typecheck:watch": "vitest typecheck"
Expand Down

0 comments on commit 6bc2306

Please sign in to comment.