Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion test/client_setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ rclnodejs
rclnodejs.spin(node);

process.on('SIGINT', function () {
timer.cancel();
node.destroy();
rclnodejs.shutdown();
process.exit(0);
Expand Down
6 changes: 3 additions & 3 deletions test/test-lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ describe('LifecycleNode test suite', function () {
transitions[1].transition.id === 6
); // shutdown
assert.ok(
transitions[1].transition.id === 2 || // cleanup
transitions[1].transition.id === 3 || // activate
transitions[1].transition.id === 6
transitions[2].transition.id === 2 || // cleanup
transitions[2].transition.id === 3 || // activate
transitions[2].transition.id === 6
); // shutdown
});

Expand Down
2 changes: 1 addition & 1 deletion test/test-parameter-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ describe('Parameter_server tests', function () {

// A.p3 value
const p3 = Parameter.fromParameterMessage({
name: 'p1',
name: 'A.p3',
value: response.values[1],
});
assert.equal(p3.type, ParameterType.PARAMETER_BOOL);
Expand Down
7 changes: 7 additions & 0 deletions test/test-rate.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,12 @@ describe('rclnodejs rate test suite', function () {
arr.reduce((prev, cur) => {
return prev + cur;
}, 0) / dataSize;

// avg sleep time should be within a reasonable range of the expected period
const expectedPeriod = 1000 / hz; // 1ms
assert.ok(
avg < expectedPeriod * 5,
`Average sleep time ${avg}ms exceeded 5x the expected period ${expectedPeriod}ms`
);
Comment on lines +111 to +116
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

avg is measured from before rate.sleep() until after rclnodejs.spinOnce(node, 0), so it includes both the sleep duration and the spin time. Comparing that combined value against the expected sleep period can make this test inaccurate/flaky; consider measuring end immediately after await rate.sleep() (or otherwise accounting for spinOnce overhead) so the assertion reflects what it intends to validate.

Copilot uses AI. Check for mistakes.
});
});
2 changes: 0 additions & 2 deletions test/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ describe('Utils testing', function () {
await utils.ensureDir(dir);
});

it('should valid ensureDirSync works correctly', function () {});

it('should verify ensureDirSync works correctly', function () {
const dir = path.join(tmpDir, 'nested/sync/dir');
utils.ensureDirSync(dir);
Expand Down
1 change: 0 additions & 1 deletion test/types/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,6 @@ const actionClient = new rclnodejs.ActionClient(
expectType<rclnodejs.ActionClient<'example_interfaces/action/Fibonacci'>>(
actionClient
);
expectType<boolean>(client.isServiceServerAvailable());
expectType<Promise<boolean>>(actionClient.waitForServer());
expectType<void>(actionClient.destroy());

Expand Down
Loading