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 Jan 29, 2023
1 parent 8b784c5 commit 3ea1ba9
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 8 deletions.
97 changes: 97 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# 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: true

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/

profiling:
critical_files_paths:
- src/is-builtin.ts
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 .env.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
#
# - https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/dotenv

[ -f $PWD/.env.local ] && source $PWD/.env.local
NODE_NO_WARNINGS=1
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ vitest.config.*.timestamp-*.mjs
yarn.lock

# NEGATED PATTERNS
!.codecov.yml
!.commitlintrc.json
!.cspell.json
!.eslintrc.base.cjs
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
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_ENV` |
| `NODE_NO_WARNINGS` |
Expand Down Expand Up @@ -233,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 @@ -259,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 @@ -359,8 +380,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 @@ -379,7 +400,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/is-builtin/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/is-builtin/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 @@
# is-builtin

[![npm](https://img.shields.io/npm/v/@flex-development/is-builtin.svg)](https://npmjs.com/package/@flex-development/is-builtin)
[![codecov](https://codecov.io/github/flex-development/is-builtin/branch/main/graph/badge.svg?token=MQ427OD7XD)](https://codecov.io/github/flex-development/is-builtin)
[![module type: esm](https://img.shields.io/badge/module%20type-esm-brightgreen)](https://github.com/voxpelli/badges-cjs-esm)
[![license](https://img.shields.io/github/license/flex-development/is-builtin.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 @@ -48,6 +48,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 @@ -62,6 +64,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 3ea1ba9

Please sign in to comment.