Skip to content

Commit 3cec96a

Browse files
committed
Fix test coverage
1 parent a5bdf68 commit 3cec96a

5 files changed

Lines changed: 20 additions & 12 deletions

File tree

.c8rc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extension": [".js"],
3+
"include": ["lib/**", "index.js"],
4+
"reporter": ["lcov"],
5+
"report-dir": "./coverage"
6+
}

.github/workflows/linux-x64-build-and-test.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,15 @@ jobs:
140140
source /opt/ros/${{ matrix.ros_distribution }}/setup.bash
141141
npm i
142142
npm run lint
143-
npm test
143+
# c8 (coverage) depends on yargs 17, whose extensionless `yargs/yargs`
144+
# entry fails to load under `require()` on Node 26. Coverage is only
145+
# uploaded from the Node 24.X leg, so wrap with c8 there and run the
146+
# plain suite everywhere else to keep the Node 26 lane green.
147+
if [ "${{ matrix.node-version }}" = "24.X" ]; then
148+
npm run test:coverage
149+
else
150+
npm test
151+
fi
144152
npm run clean
145153
146154
- name: Test with IDL ROS messages (rolling / lyrical)

.nycrc.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

bin/rclnodejs-web.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//
1212
// For frontend developers who don't want to write a Node.js server.
1313
// Run `rclnodejs-web --help` or `npx rclnodejs-web web.json` to start
14-
// demo. See demo/web/javascript/README.md for the full demo.
14+
// the runtime.
1515

1616
import path from 'node:path';
1717
import fs from 'node:fs';

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@
4646
"docs": "make -C tools/jsdoc",
4747
"docs:gh-pages": "node tools/jsdoc/regenerate-published-docs.js --branch origin/gh-pages --preserve-published",
4848
"docs:gh-pages:full": "node tools/jsdoc/regenerate-published-docs.js --branch origin/gh-pages --full-rebuild",
49-
"test": "nyc node --expose-gc ./scripts/run_test.cjs && tsd && npm install --no-save electron && node test/electron/run_test.cjs",
50-
"test-idl": "nyc node --expose-gc ./scripts/run_test.cjs --idl",
49+
"test": "node --expose-gc ./scripts/run_test.cjs && tsd && npm install --no-save electron && node test/electron/run_test.cjs",
50+
"test:coverage": "c8 node --expose-gc ./scripts/run_test.cjs && tsd && npm install --no-save electron && node test/electron/run_test.cjs",
51+
"test-idl": "node --expose-gc ./scripts/run_test.cjs --idl",
5152
"lint": "eslint && node ./scripts/cpplint.cjs",
5253
"test:asan": "bash scripts/run_asan_test.sh",
5354
"format": "clang-format -i -style=file ./src/*.cpp ./src/*.h && npx --yes prettier --write \"{lib,rosidl_gen,rostsd_gen,rosidl_parser,types,example,test,scripts,benchmark,rostsd_gen}/**/*.{js,cjs,md,ts}\" ./*.{js,md,ts}",
@@ -79,6 +80,7 @@
7980
"@types/node": "^25.0.2",
8081
"@typescript-eslint/eslint-plugin": "^8.18.0",
8182
"@typescript-eslint/parser": "^8.18.0",
83+
"c8": "^11.0.0",
8284
"clang-format": "^1.8.0",
8385
"commander": "^15.0.0",
8486
"coveralls": "^3.1.1",
@@ -92,7 +94,6 @@
9294
"lint-staged": "^17.0.0",
9395
"mocha": "^11.0.2",
9496
"node-gyp": "^12.2.0",
95-
"nyc": "^18.0.0",
9697
"prebuildify": "^6.0.1",
9798
"rimraf": "^6.0.1",
9899
"sinon": "^22.0.0",

0 commit comments

Comments
 (0)