Skip to content

Update dependency tap to v16 #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

F3n67u
Copy link
Member

@F3n67u F3n67u commented Jul 23, 2022

Problem

npm run test fail with node v18:

$ node -v
v18.2.0
$ npx tap -v               
14.11.0
$ npm run test

> [email protected] test
> STATUS=0; tap test/**/*.test.js || STATUS=$?; standard || STATUS=$?; exit $STATUS

Error: Cannot find module './reports/base'
Require stack:
- /Users/feng/dev/node-pr-labeler/node_modules/jackspeak/noop.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:939:15)
    at resolveFileName (/Users/feng/dev/node-pr-labeler/node_modules/tap/node_modules/resolve-from/index.js:17:39)
    at resolveFrom (/Users/feng/dev/node-pr-labeler/node_modules/tap/node_modules/resolve-from/index.js:31:9)
    at module.exports (/Users/feng/dev/node-pr-labeler/node_modules/tap/node_modules/resolve-from/index.js:34:41)
    at importJSX (/Users/feng/dev/node-pr-labeler/node_modules/tap/node_modules/import-jsx/index.js:24:21)
    at module.exports (/Users/feng/dev/node-pr-labeler/node_modules/tap/node_modules/treport/lib/index.js:13:18)
    at exports.makeReporter (/Users/feng/dev/node-pr-labeler/node_modules/tap/bin/run.js:422:23)
    at runTests (/Users/feng/dev/node-pr-labeler/node_modules/tap/bin/run.js:744:3)
    at mainAsync (/Users/feng/dev/node-pr-labeler/node_modules/tap/bin/run.js:244:5)
    at main (/Users/feng/dev/node-pr-labeler/node_modules/tap/bin/run.js:127:3) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/Users/feng/dev/node-pr-labeler/node_modules/jackspeak/noop.js' ]
}
TAP version 13
1..0
# time=2.888ms
----------|----------|----------|----------|----------|-------------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files |        0 |        0 |        0 |        0 |                   |
----------|----------|----------|----------|----------|-------------------|

Solution

The latest tap has fixed this problem, so I update tap to the latest.

$ npx tap -v
16.3.0
$ npm run test

> [email protected] test
> STATUS=0; tap test/**/*.test.js || STATUS=$?; standard || STATUS=$?; exit $STATUS

​ PASS ​ test/node-repo.test.js 3 OK 59.38ms
​ PASS ​ test/node-build-label.test.js 28 OK 152.937ms
​ PASS ​ test/node-js-subsystem-labels.test.js 86 OK 272.802ms
​ PASS ​ test/resolve-labels.test.js 196 OK 649.712ms


                         
  🌈 SUMMARY RESULTS 🌈  
                         

Suites:   ​4 passed​, ​4 of 4 completed​
Asserts:  ​​​313 passed​, ​of 313​
​Time:​   ​2s​
ERROR: Coverage for lines (73.21%) does not meet global threshold (100%)
ERROR: Coverage for functions (70.58%) does not meet global threshold (100%)
ERROR: Coverage for branches (85.71%) does not meet global threshold (100%)
ERROR: Coverage for statements (71.54%) does not meet global threshold (100%)
-------------------|---------|----------|---------|---------|-------------------
File               | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
-------------------|---------|----------|---------|---------|-------------------
All files          |   71.54 |    85.71 |   70.58 |   73.21 |                   
 node-repo.js      |   28.57 |    22.22 |   23.07 |   30.23 | 13-64,89-105      
 resolve-labels.js |     100 |      100 |     100 |     100 |                   
-------------------|---------|----------|---------|---------|-------------------

Refs: tapjs/tapjs#746

@@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"build": "ncc build index.js",
"test": "STATUS=0; tap test/**/*.test.js || STATUS=$?; standard || STATUS=$?; exit $STATUS"
"test": "STATUS=0; tap test/**/*.test.js --no-check-coverage || STATUS=$?; standard || STATUS=$?; exit $STATUS"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of version 7, and by default starting in version 15, node-tap lets you easily enforce 100% coverage of all lines, branches, functions, and statements.

see https://node-tap.org/docs/coverage/#maximal-coverage-

@avivkeller avivkeller mentioned this pull request Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant