Skip to content

Commit

Permalink
test: increase coverage for worker
Browse files Browse the repository at this point in the history
test new Worker() with invalid NODE_OPTIONS
Refs: https://coverage.nodejs.org/coverage-743ee9d2c05efefe/lib/internal/worker.js.html#L179

PR-URL: #36491
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
Lxxyx authored and targos committed Dec 21, 2020
1 parent 149f2cf commit 9fc2479
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/parallel/test-worker-execargv-invalid.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,17 @@ const { Worker } = require('worker_threads');
new Worker(__filename, { execArgv: ['--redirect-warnings'] });
}, expectedErr);
}

{
const expectedErr = {
code: 'ERR_WORKER_INVALID_EXEC_ARGV',
name: 'Error'
};
assert.throws(() => {
new Worker(__filename, {
env: {
NODE_OPTIONS: '--nonexistent-options'
}
});
}, expectedErr);
}

0 comments on commit 9fc2479

Please sign in to comment.