You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
886 B

'use strict';
const common = require('../common');
const assert = require('assert');
const execFile = require('child_process').execFile;
const scripts = [
`os.userInfo({
get encoding() {
throw new Error('xyz');
}
})`
];
['filename', 'cachedData', 'produceCachedData', 'lineOffset', 'columnOffset']
.forEach((prop) => {
scripts.push(`vm.createScript('', {
get ${prop} () {
throw new Error('xyz');
}
})`);
});
['breakOnSigint', 'timeout', 'displayErrors']
.forEach((prop) => {
scripts.push(`vm.createScript('').runInThisContext({
get ${prop} () {
throw new Error('xyz');
}
})`);
});
scripts.forEach((script) => {
const node = process.execPath;
execFile(node, [ '-e', script ], common.mustCall((err, stdout, stderr) => {
assert(stderr.includes('Error: xyz'), 'createScript crashes');
}));
});