mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
Unifes assertSnapshot common patterns like platform specific path separators, line ending, line trailing spaces, Node.js version strings, and pids in warning messages. PR-URL: https://github.com/nodejs/node/pull/61590 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
27 lines
902 B
JavaScript
27 lines
902 B
JavaScript
import '../common/index.mjs';
|
|
import * as fixtures from '../common/fixtures.mjs';
|
|
import * as snapshot from '../common/assertSnapshot.js';
|
|
import { describe, it } from 'node:test';
|
|
|
|
describe('vm output', { concurrency: !process.env.TEST_PARALLEL }, () => {
|
|
function normalize(str) {
|
|
return str.replaceAll(/node:vm:\d+:\d+/g, 'node:vm:*');
|
|
}
|
|
|
|
const defaultTransform = snapshot
|
|
.transform(snapshot.basicTransform, snapshot.transformProjectRoot(), normalize);
|
|
|
|
const tests = [
|
|
{ name: 'vm/vm_caught_custom_runtime_error.js' },
|
|
{ name: 'vm/vm_display_runtime_error.js' },
|
|
{ name: 'vm/vm_display_syntax_error.js' },
|
|
{ name: 'vm/vm_dont_display_runtime_error.js' },
|
|
{ name: 'vm/vm_dont_display_syntax_error.js' },
|
|
];
|
|
for (const { name } of tests) {
|
|
it(name, async () => {
|
|
await snapshot.spawnAndAssert(fixtures.path(name), defaultTransform);
|
|
});
|
|
}
|
|
});
|