mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
test: make eval snapshot comparison more flexible
PR-URL: https://github.com/nodejs/node/pull/57020 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
4466e07540
commit
ee8939c82f
4
test/fixtures/eval/eval_messages.snapshot
vendored
4
test/fixtures/eval/eval_messages.snapshot
vendored
|
|
@ -40,7 +40,7 @@ Node.js *
|
|||
var ______________________________________________; throw 10
|
||||
^
|
||||
10
|
||||
(Use `node --trace-uncaught ...` to show where the exception was thrown)
|
||||
(Use `* --trace-uncaught ...` to show where the exception was thrown)
|
||||
|
||||
Node.js *
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ Node.js *
|
|||
var ______________________________________________; throw 10
|
||||
^
|
||||
10
|
||||
(Use `node --trace-uncaught ...` to show where the exception was thrown)
|
||||
(Use `* --trace-uncaught ...` to show where the exception was thrown)
|
||||
|
||||
Node.js *
|
||||
done
|
||||
|
|
|
|||
4
test/fixtures/eval/stdin_messages.snapshot
vendored
4
test/fixtures/eval/stdin_messages.snapshot
vendored
|
|
@ -40,7 +40,7 @@ Node.js *
|
|||
let ______________________________________________; throw 10
|
||||
^
|
||||
10
|
||||
(Use `node --trace-uncaught ...` to show where the exception was thrown)
|
||||
(Use `* --trace-uncaught ...` to show where the exception was thrown)
|
||||
|
||||
Node.js *
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ Node.js *
|
|||
let ______________________________________________; throw 10
|
||||
^
|
||||
10
|
||||
(Use `node --trace-uncaught ...` to show where the exception was thrown)
|
||||
(Use `* --trace-uncaught ...` to show where the exception was thrown)
|
||||
|
||||
Node.js *
|
||||
done
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import '../common/index.mjs';
|
||||
import * as fixtures from '../common/fixtures.mjs';
|
||||
import * as snapshot from '../common/assertSnapshot.js';
|
||||
import { basename } from 'node:path';
|
||||
import { describe, it } from 'node:test';
|
||||
|
||||
describe('eval output', { concurrency: true }, () => {
|
||||
|
|
@ -16,6 +17,7 @@ describe('eval output', { concurrency: true }, () => {
|
|||
snapshot.replaceNodeVersion,
|
||||
removeStackTraces,
|
||||
filterEmptyLines,
|
||||
generalizeProcessName,
|
||||
);
|
||||
|
||||
function removeStackTraces(output) {
|
||||
|
|
@ -26,6 +28,11 @@ describe('eval output', { concurrency: true }, () => {
|
|||
return output.replaceAll(/^\s*$/gm, '');
|
||||
}
|
||||
|
||||
function generalizeProcessName(output) {
|
||||
const baseName = basename(process.argv0 || 'node', '.exe');
|
||||
return output.replaceAll(`${baseName} --`, '* --');
|
||||
}
|
||||
|
||||
const tests = [
|
||||
{ name: 'eval/eval_messages.js' },
|
||||
{ name: 'eval/stdin_messages.js' },
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user