-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update contributing doc on unit test execution
- Loading branch information
Showing
3 changed files
with
35 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.vscode | ||
coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ When contributing, apply this project's JavaScript standard style, otherwise it | |
|
||
## Requirements | ||
|
||
- Node 20.8.0 | ||
- Node 18.18.0 | ||
- NPM | ||
- ElasticSearch 7.17 | ||
|
||
|
@@ -19,72 +19,65 @@ $ git clone https://github.com/perftool-incubator/CommonDataModel.git | |
2. Change your current working directory to the CDMQ directory. | ||
|
||
```shell | ||
$ cd CommonDataModel/queries/cdmq | ||
$ cd CommonDataModel | ||
``` | ||
|
||
3. Install this project's Node JS dependencies. | ||
|
||
```shell | ||
$ npm install | ||
$ npm install --prefix queries | ||
``` | ||
|
||
4. Check current code style if changes are required with [prettier](https://prettier.io/docs/en/cli.html) using [npx](https://docs.npmjs.com/cli/v7/commands/npx). | ||
|
||
```shell | ||
$ npx prettier *.js --check | ||
$ npx prettier --check "queries/**/*.js" | ||
``` | ||
|
||
5. Apply code style changes. | ||
|
||
```shell | ||
$ npx prettier *.js --write | ||
$ npx prettier --write "queries/**/*.js" | ||
``` | ||
|
||
## Unit Tests | ||
|
||
1. Change your current working directory to the CDMQ directory. | ||
|
||
```shell | ||
$ cd CommonDataModel/queries/cdmq | ||
``` | ||
|
||
2. Verify Node 20.8.0 | ||
1. Verify Node 18 | ||
|
||
```shell | ||
$ node -v | ||
v20.8.0 | ||
v18.18.0 | ||
``` | ||
|
||
3. Install this project's Node JS dependencies. | ||
2. Install this project's Node JS dependencies. | ||
|
||
```shell | ||
$ npm install | ||
$ npm install --prefix queries | ||
``` | ||
|
||
3. Execute all JavaScript unit test files with code coverage. | ||
|
||
```shell | ||
$ node --experimental-test-coverage queries/cdmq/test/*.test.js | ||
|
||
✔ set(ish) difference (subtractTwoArrays) (1.599154ms) | ||
✔ set(ish) intersection (intersectTwoArrays) (0.161839ms) | ||
✔ intersect all arrays (0.154675ms) | ||
ℹ tests 3 | ||
ℹ suites 0 | ||
ℹ pass 3 | ||
ℹ fail 0 | ||
ℹ cancelled 0 | ||
ℹ skipped 0 | ||
ℹ todo 0 | ||
ℹ duration_ms 9.275733 | ||
ℹ start of coverage report | ||
ℹ --------------------------------------------------------------------------------------------- | ||
ℹ file | line % | branch % | funcs % | uncovered lines | ||
ℹ --------------------------------------------------------------------------------------------- | ||
ℹ …/cdm.js | 13.30 | 100.00 | 8.82 | 5-7 22-28 31-39 64-76 86-178 188-195 199 204-211 2… | ||
ℹ …test.js | 100.00 | 100.00 | 100.00 | | ||
ℹ --------------------------------------------------------------------------------------------- | ||
ℹ all fil… | 15.05 | 100.00 | 12.68 | | ||
ℹ --------------------------------------------------------------------------------------------- | ||
ℹ end of coverage report | ||
$ npm test --prefix queries | ||
|
||
> [email protected] test | ||
> jest | ||
|
||
PASS test/cdm.test.js | ||
set(ish)-array behavior | ||
✓ set(ish) difference (subtractTwoArrays) (6 ms) | ||
✓ set(ish) intersection (intersectTwoArrays) (1 ms) | ||
✓ intersect all arrays (1 ms) | ||
|
||
----------|---------|----------|---------|---------|------------------------------------------- | ||
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | ||
----------|---------|----------|---------|---------|------------------------------------------- | ||
All files | 10.63 | 100 | 4.61 | 10.63 | | ||
cdm.js | 10.63 | 100 | 4.61 | 10.63 | ...720-1729,1744-2022,2026-2041,2057-2180 | ||
----------|---------|----------|---------|---------|------------------------------------------- | ||
Test Suites: 1 passed, 1 total | ||
Tests: 3 passed, 3 total | ||
Snapshots: 0 total | ||
Time: 0.703 s, estimated 1 s | ||
Ran all test suites. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters