Skip to content

Commit 7c7e9f4

Browse files
codebyteretargos
authored andcommitted
test: make eval snapshot comparison more flexible
PR-URL: #57020 Reviewed-By: Luigi Pinca <[email protected]>
1 parent 66614cf commit 7c7e9f4

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

‎test/fixtures/eval/eval_messages.snapshot‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ Node.js *
4040
var ______________________________________________; throw 10
4141
^
4242
10
43-
(Use `node --trace-uncaught ...` to show where the exception was thrown)
43+
(Use `* --trace-uncaught ...` to show where the exception was thrown)
4444

4545
Node.js *
4646

4747
[eval]:1
4848
var ______________________________________________; throw 10
4949
^
5050
10
51-
(Use `node --trace-uncaught ...` to show where the exception was thrown)
51+
(Use `* --trace-uncaught ...` to show where the exception was thrown)
5252

5353
Node.js *
5454
done

‎test/fixtures/eval/stdin_messages.snapshot‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ Node.js *
4040
let ______________________________________________; throw 10
4141
^
4242
10
43-
(Use `node --trace-uncaught ...` to show where the exception was thrown)
43+
(Use `* --trace-uncaught ...` to show where the exception was thrown)
4444

4545
Node.js *
4646

4747
[stdin]:1
4848
let ______________________________________________; throw 10
4949
^
5050
10
51-
(Use `node --trace-uncaught ...` to show where the exception was thrown)
51+
(Use `* --trace-uncaught ...` to show where the exception was thrown)
5252

5353
Node.js *
5454
done

‎test/parallel/test-node-output-eval.mjs‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import'../common/index.mjs';
22
import*asfixturesfrom'../common/fixtures.mjs';
33
import*assnapshotfrom'../common/assertSnapshot.js';
4+
import{basename}from'node:path';
45
import{describe,it}from'node:test';
56

67
describe('eval output',{concurrency: true},()=>{
@@ -16,6 +17,7 @@ describe('eval output',{concurrency: true }, () =>{
1617
snapshot.replaceNodeVersion,
1718
removeStackTraces,
1819
filterEmptyLines,
20+
generalizeProcessName,
1921
);
2022

2123
functionremoveStackTraces(output){
@@ -26,6 +28,11 @@ describe('eval output',{concurrency: true }, () =>{
2628
returnoutput.replaceAll(/^\s*$/gm,'');
2729
}
2830

31+
functiongeneralizeProcessName(output){
32+
constbaseName=basename(process.argv0||'node','.exe');
33+
returnoutput.replaceAll(`${baseName} --`,'* --');
34+
}
35+
2936
consttests=[
3037
{name: 'eval/eval_messages.js'},
3138
{name: 'eval/stdin_messages.js'},

0 commit comments

Comments
(0)