Skip to content

Commit

Permalink
Re-enable coveralls
Browse files Browse the repository at this point in the history
Fix: #1063
  • Loading branch information
minggangw committed Mar 7, 2025
1 parent af19b4c commit 2e04c84
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 5 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/linux-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,20 @@ jobs:
npm i
npm run lint
npm test
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: run-${{ matrix.node-version}}
parallel: true

finish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ build
log
.vscode
.project
.nyc_output/
coverage/

# test build artifacts
/test/cpp/add_two_ints_client
Expand Down
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ suppr.txt
types/interfaces.d.ts
generated/
build/
coverage/
dist/
electron_demo/
log/
Expand All @@ -21,5 +22,6 @@ example/
benchmark/
tutorials/
.github/
.nyc_output/
.vscode/
.husky/
7 changes: 7 additions & 0 deletions .nycrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extension:
- .js
include:
- lib/**/*
report-dir: './coverage'
reporter:
- lcov
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
"install": "npm run rebuild",
"postinstall": "npm run generate-messages",
"docs": "cd docs && make",
"test": "node --expose-gc ./scripts/run_test.js && npx tsd",
"test": "nyc node --expose-gc ./scripts/run_test.js && npx tsd",
"lint": "eslint && node ./scripts/cpplint.js",
"format": "clang-format -i -style=file ./src/*.cpp ./src/*.hpp && prettier --write \"{lib,rosidl_gen,rostsd_gen,rosidl_parser,types,example,test,scripts,benchmark}/**/*.{js,md,ts}\" ./*.{js,md,ts}",
"prepare": "husky"
"prepare": "husky",
"coverage": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
},
"bin": {
"generate-ros-messages": "./scripts/generate_messages.js"
Expand All @@ -49,6 +50,7 @@
"@typescript-eslint/parser": "^8.18.0",
"clang-format": "^1.8.0",
"commander": "^13.1.0",
"coveralls": "^3.1.1",
"deep-equal": "^2.2.3",
"eslint": "^9.16.0",
"eslint-config-prettier": "^10.0.2",
Expand All @@ -58,6 +60,7 @@
"jsdoc": "^4.0.4",
"lint-staged": "^15.2.10",
"mocha": "^11.0.2",
"nyc": "^17.1.0",
"rimraf": "^6.0.1",
"sinon": "^19.0.2",
"tree-kill": "^1.2.2",
Expand Down
11 changes: 8 additions & 3 deletions test/test-signals.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,21 @@ function forkOnlyRemoveRclnodejsHandlers() {
const myHandler = () => {};
process.on('SIGINT', myHandler);
rclnodejs.removeSignalHandlers();
if (myHandler in process.listeners('SIGINT')) {
if (process.listeners('SIGINT').includes(myHandler)) {
process.exitCode = 0;
} else {
process.exitCode = 1;
}
}

function forkRemoveSignalHandlers() {
const listenerCount = process.listenerCount('SIGINT');
rclnodejs.removeSignalHandlers();
process.exitCode = process.listenerCount('SIGINT');
if (listenerCount - 1 === process.listenerCount('SIGINT')) {
process.exitCode = 0;
} else {
process.exitCode = 1;
}
}

function forkDoPublish(context) {
Expand Down Expand Up @@ -146,7 +151,7 @@ if (process.env['RCLNODEJS_TEST_FORK']) {
);
await new Promise((res) => {
child.on('close', (exitCode) => {
assert.strictEqual(exitCode, 1);
assert.strictEqual(exitCode, 0);
res();
});
});
Expand Down

0 comments on commit 2e04c84

Please sign in to comment.