node/test/fixtures/vm/vm_caught_custom_runtime_error.js
Moshe Atlow b6738c1af0
test: migrate message tests to use assertSnapshot
PR-URL: https://github.com/nodejs/node/pull/47498
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-04-27 06:41:58 +00:00

19 lines
458 B
JavaScript

'use strict';
require('../../common');
const vm = require('vm');
console.error('beginning');
// Regression test for https://github.com/nodejs/node/issues/7397:
// vm.runInThisContext() should not print out anything to stderr by itself.
try {
vm.runInThisContext(`throw ({
name: 'MyCustomError',
message: 'This is a custom message'
})`, { filename: 'test.vm' });
} catch (e) {
console.error('received error', e.name);
}
console.error('end');