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>
39 lines
1012 B
JavaScript
39 lines
1012 B
JavaScript
import * as common from '../common/index.mjs';
|
|
if (!process.config.variables.node_use_amaro) {
|
|
common.skip('Requires Amaro');
|
|
}
|
|
import * as fixtures from '../common/fixtures.mjs';
|
|
import * as snapshot from '../common/assertSnapshot.js';
|
|
import { describe, it } from 'node:test';
|
|
|
|
describe('eval output', { concurrency: true }, () => {
|
|
function normalize(str) {
|
|
return str
|
|
.replaceAll(/\d+:\d+/g, '*:*');
|
|
}
|
|
|
|
const defaultTransform = snapshot.transform(
|
|
normalize,
|
|
snapshot.basicTransform,
|
|
snapshot.transformProjectRoot(),
|
|
removeStackTraces,
|
|
);
|
|
|
|
function removeStackTraces(output) {
|
|
return output.replaceAll(/^ *at .+$/gm, '');
|
|
}
|
|
|
|
const tests = [
|
|
{ name: 'eval/eval_messages.js' },
|
|
{ name: 'eval/stdin_messages.js' },
|
|
{ name: 'eval/stdin_typescript.js' },
|
|
{ name: 'eval/eval_typescript.js' },
|
|
];
|
|
|
|
for (const { name } of tests) {
|
|
it(name, async () => {
|
|
await snapshot.spawnAndAssert(fixtures.path(name), defaultTransform);
|
|
});
|
|
}
|
|
});
|