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 <gpunathi@in.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
  • Loading branch information
Lxxyx authored and targos committed May 1, 2021
1 parent 8b34918 commit eba2dc5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/parallel/test-worker-execargv-invalid.js
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 eba2dc5

Please sign in to comment.