summaryrefslogtreecommitdiff
path: root/test/parallel/test-vm-basic.js
diff options
context:
space:
mode:
authorBenjamin Chen <benjaminlchen@gmail.com>2018-09-18 01:28:41 -0400
committerRefael Ackermann <refack@gmail.com>2018-11-02 10:18:58 -0400
commit65fe999ed77c958468ca55c24e9242e193b55f95 (patch)
tree8977248f6c807913f3e2fd6b941d9a2f710eefea /test/parallel/test-vm-basic.js
parent74ba48294b115364b92bbd5c87c8025cd109e303 (diff)
downloadnode-new-65fe999ed77c958468ca55c24e9242e193b55f95.tar.gz
vm: allow `cachedData` to also be TypedArray|DataView
PR-URL: https://github.com/nodejs/node/pull/22921 Refs: https://github.com/nodejs/node/issues/1826 Refs: https://github.com/nodejs/node/pull/22921#issuecomment-422350213 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'test/parallel/test-vm-basic.js')
-rw-r--r--test/parallel/test-vm-basic.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/parallel/test-vm-basic.js b/test/parallel/test-vm-basic.js
index 54b7c45ff8..df0c7df106 100644
--- a/test/parallel/test-vm-basic.js
+++ b/test/parallel/test-vm-basic.js
@@ -178,18 +178,20 @@ const vm = require('vm');
'filename': 'string',
'columnOffset': 'number',
'lineOffset': 'number',
- 'cachedData': 'Uint8Array',
+ 'cachedData': 'Buffer, TypedArray, or DataView',
'produceCachedData': 'boolean',
};
for (const option in optionTypes) {
+ const typeErrorMessage = `The "options.${option}" property must be ` +
+ `${option === 'cachedData' ? 'one of' : 'of'} type`;
common.expectsError(() => {
vm.compileFunction('', undefined, { [option]: null });
}, {
type: TypeError,
code: 'ERR_INVALID_ARG_TYPE',
- message: `The "options.${option}" property must be of type ` +
- `${optionTypes[option]}. Received type object`
+ message: typeErrorMessage +
+ ` ${optionTypes[option]}. Received type object`
});
}