MCPcopy Index your code
hub / github.com/nodejs/node / checkExecution

Function checkExecution

test/parallel/test-vm-module-errors.js:176–199  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

174
175// Check the JavaScript engine deals with exceptions correctly
176async function checkExecution() {
177 await (async () => {
178 const m = new SourceTextModule('import { nonexistent } from "module";');
179
180 // There is no code for this exception since it is thrown by the JavaScript
181 // engine.
182 await assert.rejects(() => {
183 return m.link(common.mustCall(() => new SourceTextModule('')));
184 }, SyntaxError);
185 })();
186
187 await (async () => {
188 const m = new SourceTextModule('throw new Error();');
189 await m.link(common.mustNotCall());
190 try {
191 await m.evaluate();
192 } catch (err) {
193 assert.strictEqual(m.error, err);
194 assert.strictEqual(m.status, 'errored');
195 return;
196 }
197 assert.fail('Missing expected exception');
198 })();
199}
200
201// Check for error thrown when breakOnSigint is not a boolean for evaluate()
202async function checkInvalidOptionForEvaluate() {

Callers 1

Calls 3

linkMethod · 0.45
evaluateMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…