mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
vm: throw error when duplicated exportNames in SyntheticModule
Fixes: https://github.com/nodejs/node/issues/32806 PR-URL: https://github.com/nodejs/node/pull/32810 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
1 parent
c87ed21fdf
commit
4423304ac4
2 files changed
+23
-3
No files matched your search
@@ -125,12 +125,22 @@ const util = require('util');
|
||||
// Check to throws invalid exportNames
|
||||
{
|
||||
assert.throws(() => new SyntheticModule(undefined, () => {}, {}), {
|
||||
message: 'The "exportNames" argument must be an Array of strings.' +
|
||||
' Received undefined',
|
||||
message: 'The "exportNames" argument must be an ' +
|
||||
'Array of unique strings.' +
|
||||
' Received undefined',
|
||||
name: 'TypeError'
|
||||
});
|
||||
}
|
||||
|
||||
// Check to throws duplicated exportNames
|
||||
// https://github.com/nodejs/node/issues/32806
|
||||
{
|
||||
assert.throws(() => new SyntheticModule(['x', 'x'], () => {}, {}), {
|
||||
message: 'The argument \'exportNames.x\' is duplicated. Received \'x\'',
|
||||
name: 'TypeError',
|
||||
});
|
||||
}
|
||||
|
||||
// Check to throws invalid evaluateCallback
|
||||
{
|
||||
assert.throws(() => new SyntheticModule([], undefined, {}), {
|
||||
|
||||
Reference in new issue
Block a user