Skip to content

Commit

Permalink
chore(tests): 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 Feb 1, 2023
1 parent 282e260 commit b32e474
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 8 deletions.
93 changes: 93 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# CODECOV CONFIGURATION
# https://docs.codecov.com/docs/codecovyml-reference

---
codecov:
notify:
after_n_builds: 4
wait_for_ci: true
require_ci_to_pass: true

comment:
after_n_builds: 4
behavior: default
layout: header,diff,flags,tree,footer
require_base: false
require_changes: false
require_head: true
show_carryforward_flags: true
show_critical_paths: false

coverage:
precision: 2
range: 90..100
round: nearest
status:
changes:
default:
branches:
- dependabot/*
- feat/*
- hotfix/*
- main
- release/*
if_ci_failed: error
if_not_found: success
informational: false
only_pulls: false
patch:
default:
branches:
- dependabot/*
- feat/*
- hotfix/*
- main
- release/*
if_ci_failed: error
if_not_found: success
informational: false
only_pulls: false
target: 100%
threshold: 0%
project:
default:
branches:
- dependabot/*
- feat/*
- hotfix/*
- main
- release/*
if_ci_failed: error
if_not_found: success
informational: false
only_pulls: false
target: 100%
threshold: 0%

flags:
node19:
carryforward: false
paths:
- src/
node18:
carryforward: false
paths:
- src/
node16:
carryforward: false
paths:
- src/
node14:
carryforward: false
paths:
- src/

github_checks:
annotations: true

ignore:
- '**/__mocks__/**'
- '**/__tests__/**'
- '**/index.ts'
- src/interfaces/
- src/types/
1 change: 1 addition & 0 deletions .dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ bdougie
booleanish
bson
cefc
codecov
commitlintrc
dawidd
dedupe
Expand Down
39 changes: 31 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Follow the steps below to setup your local development environment:

| name |
| ----------------------- |
| `CODECOV_TOKEN` |
| `GITHUB_TOKEN` |
| `NODE_NO_WARNINGS` |
| `PAT_BOT` |
Expand Down Expand Up @@ -232,11 +233,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 @@ -258,7 +279,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 @@ -358,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 @@ -378,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/tutils/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/tutils/discussions/new?category=q-a
[20]: https://stackoverflow.com/help/minimal-reproducible-example
[21]: https://github.com/features/packages
[22]: https://npmjs.com
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# tutils

[![npm](https://img.shields.io/npm/v/@flex-development/tutils.svg)](https://npmjs.com/package/@flex-development/tutils)
[![codecov](https://codecov.io/gh/flex-development/tutils/branch/main/graph/badge.svg?token=ZT857Z0ITA)](https://codecov.io/gh/flex-development/tutils)
[![module type: cjs+esm](https://img.shields.io/badge/module%20type-cjs%2Besm-brightgreen)](https://github.com/voxpelli/badges-cjs-esm)
[![license](https://img.shields.io/github/license/flex-development/tutils.svg)](LICENSE.md)
[![conventional commits](https://img.shields.io/badge/-conventional%20commits-fe5196?logo=conventional-commits&logoColor=ffffff)](https://conventionalcommits.org/)
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
"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",
"codecov:validate": "cat .codecov.yml | curl --data-binary @- https://codecov.io/validate",
"fix:cg": "yarn fix:format && yarn fix:lint",
"fix:dedupe": "yarn dedupe --strategy=highest",
"fix:format": "prettier --cache --write .",
Expand All @@ -78,6 +80,7 @@
"test": "vitest run",
"test:cov": "yarn clean:coverage; yarn test --coverage",
"test:cov:serve": "serve -l 5432 ./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 b32e474

Please sign in to comment.