Skip to content

Commit a45d280

Browse files
juanarboltargos
authored andcommitted
test: improve coverage on worker threads
PR-URL: #36910 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent ec4d79e commit a45d280

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

test/parallel/test-worker-unsupported-things.js

+16-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ if (!process.env.HAS_STARTED_WORKER) {
2424
assert.strictEqual(process.debugPort, before);
2525
}
2626

27+
{
28+
const mask = 0o600;
29+
assert.throws(() => { process.umask(mask); }, {
30+
code: 'ERR_WORKER_UNSUPPORTED_OPERATION',
31+
message: 'Setting process.umask() is not supported in workers'
32+
});
33+
}
34+
2735
const stubs = ['abort', 'chdir', 'send', 'disconnect'];
2836

2937
if (!common.isWindows) {
@@ -35,13 +43,19 @@ if (!process.env.HAS_STARTED_WORKER) {
3543
assert.strictEqual(process[fn].disabled, true);
3644
assert.throws(() => {
3745
process[fn]();
38-
}, { code: 'ERR_WORKER_UNSUPPORTED_OPERATION' });
46+
}, {
47+
code: 'ERR_WORKER_UNSUPPORTED_OPERATION',
48+
message: `process.${fn}() is not supported in workers`
49+
});
3950
});
4051

4152
['channel', 'connected'].forEach((fn) => {
4253
assert.throws(() => {
4354
process[fn]; // eslint-disable-line no-unused-expressions
44-
}, { code: 'ERR_WORKER_UNSUPPORTED_OPERATION' });
55+
}, {
56+
code: 'ERR_WORKER_UNSUPPORTED_OPERATION',
57+
message: `process.${fn} is not supported in workers`
58+
});
4559
});
4660

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

0 commit comments

Comments
 (0)