mirror of
https://github.com/nodejs/node.git
synced 2025-04-28 13:40:37 +00:00

PR-URL: https://github.com/nodejs/node/pull/56685 Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
20 lines
577 B
JavaScript
20 lines
577 B
JavaScript
// Flags: --permission --allow-fs-read=* --experimental-test-module-mocks
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('node:assert');
|
|
|
|
{
|
|
const diagnostics_channel = require('node:diagnostics_channel');
|
|
diagnostics_channel.subscribe('worker_threads', common.mustNotCall());
|
|
const { mock } = require('node:test');
|
|
|
|
// Module mocking should throw instead of posting to worker_threads dc
|
|
assert.throws(() => {
|
|
mock.module('node:path');
|
|
}, common.expectsError({
|
|
code: 'ERR_ACCESS_DENIED',
|
|
permission: 'WorkerThreads',
|
|
}));
|
|
}
|