blob: 35b553d587c6e477de8e54f629c6ae7201590d51 [file] [edit]
'use strict';
const common = require('../common');
const { Script, compileFunction } = require('vm');
const assert = require('assert');
assert.rejects(async () => {
const script = new Script('import("fs")');
const imported = script.runInThisContext();
await imported;
}, {
code: 'ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING'
}).then(common.mustCall());
assert.rejects(async () => {
const imported = compileFunction('return import("fs")')();
await imported;
}, {
code: 'ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING'
}).then(common.mustCall());