Skip to content

Commit

Permalink
test: improve coverage on worker threads
Browse files Browse the repository at this point in the history
PR-URL: #36910
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
juanarbol authored and ruyadorno committed Jan 21, 2021
1 parent 8cf280d commit 3bbe9a5
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions test/parallel/test-worker-unsupported-things.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ if (!process.env.HAS_STARTED_WORKER) {
assert.strictEqual(process.debugPort, before);
}

{
const mask = 0o600;
assert.throws(() => { process.umask(mask); }, {
code: 'ERR_WORKER_UNSUPPORTED_OPERATION',
message: 'Setting process.umask() is not supported in workers'
});
}

const stubs = ['abort', 'chdir', 'send', 'disconnect'];

if (!common.isWindows) {
Expand All @@ -35,13 +43,19 @@ if (!process.env.HAS_STARTED_WORKER) {
assert.strictEqual(process[fn].disabled, true);
assert.throws(() => {
process[fn]();
}, { code: 'ERR_WORKER_UNSUPPORTED_OPERATION' });
}, {
code: 'ERR_WORKER_UNSUPPORTED_OPERATION',
message: `process.${fn}() is not supported in workers`
});
});

['channel', 'connected'].forEach((fn) => {
assert.throws(() => {
process[fn]; // eslint-disable-line no-unused-expressions
}, { code: 'ERR_WORKER_UNSUPPORTED_OPERATION' });
}, {
code: 'ERR_WORKER_UNSUPPORTED_OPERATION',
message: `process.${fn} is not supported in workers`
});
});

assert.strictEqual('_startProfilerIdleNotifier' in process, false);
Expand Down

0 comments on commit 3bbe9a5

Please sign in to comment.