Skip to content

Commit

Permalink
[INTERNAL] Fix unit/coverage setup on Node 20
Browse files Browse the repository at this point in the history
AVA's nodeArguments option doesn't seem to work with loaders on Node 20.
Using the NODE_OPTIONS environment variable is however working properly.
This unfortunately makes the scripts more verbose but it finally allows
testing on Node 20.

JIRA: CPOUI5FOUNDATION-612
  • Loading branch information
matz3 committed Jul 12, 2023
1 parent cbdae20 commit e7b7c45
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
"test": "npm run lint && npm run jsdoc-generate && npm run coverage && npm run depcheck",
"test-azure": "npm run coverage-xunit",
"lint": "eslint ./",
"unit": "rimraf test/tmp && ava",
"unit-verbose": "rimraf test/tmp && cross-env UI5_LOG_LVL=verbose ava --verbose --serial",
"unit": "rimraf test/tmp && cross-env NODE_OPTIONS=\"--loader=esmock --no-warnings\" ava",
"unit-verbose": "rimraf test/tmp && cross-env UI5_LOG_LVL=verbose NODE_OPTIONS=\"--loader=esmock --no-warnings\" ava --verbose --serial",
"unit-watch": "npm run unit -- --watch",
"unit-xunit": "rimraf test/tmp && ava --node-arguments=\"--experimental-loader=@istanbuljs/esm-loader-hook\" --tap | tap-xunit --dontUseCommentsAsTestNames=true > test-results.xml",
"unit-inspect": "cross-env UI5_LOG_LVL=verbose ava debug --break",
"coverage": "rimraf test/tmp && nyc ava --node-arguments=\"--experimental-loader=@istanbuljs/esm-loader-hook\"",
"coverage-xunit": "nyc --reporter=text --reporter=text-summary --reporter=cobertura npm run unit-xunit",
"unit-xunit": "rimraf test/tmp && NODE_OPTIONS=\"--loader=esmock --no-warnings\" ava --tap | tap-xunit --dontUseCommentsAsTestNames=true > test-results.xml",
"unit-inspect": "cross-env UI5_LOG_LVL=verbose NODE_OPTIONS=\"--loader=esmock --no-warnings\" ava debug --break",
"coverage": "rimraf test/tmp && cross-env NODE_OPTIONS=\"--loader=esmock --loader=@istanbuljs/esm-loader-hook --no-warnings\" nyc ava",
"coverage-xunit": "rimraf test/tmp && cross-env NODE_OPTIONS=\"--loader=esmock --loader=@istanbuljs/esm-loader-hook --no-warnings\" nyc --reporter=text --reporter=text-summary --reporter=cobertura ava --tap | tap-xunit --dontUseCommentsAsTestNames=true > test-results.xml",
"jsdoc": "npm run jsdoc-generate && open-cli jsdocs/index.html",
"jsdoc-generate": "jsdoc -c ./jsdoc.json -t $(node -p 'path.dirname(require.resolve(\"docdash\"))') ./lib/ || (echo 'Error during JSDoc generation! Check log.' && exit 1)",
"jsdoc-watch": "npm run jsdoc && chokidar \"./lib/**/*.js\" -c \"npm run jsdoc-generate\"",
Expand All @@ -69,10 +69,6 @@
],
"ignoredByWatcher": [
"test/tmp/**"
],
"nodeArguments": [
"--loader=esmock",
"--no-warnings"
]
},
"nyc": {
Expand Down

0 comments on commit e7b7c45

Please sign in to comment.