Skip to content

Commit 1b84e85

Browse files
committed
test: fix output tests when path includes node version
PR-URL: #47843 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
1 parent e2553b1 commit 1b84e85

4 files changed

Lines changed: 9 additions & 12 deletions

File tree

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@ import * as fixtures from '../common/fixtures.mjs';
33
import*assnapshotfrom'../common/assertSnapshot.js';
44
import{describe,it}from'node:test';
55

6-
functionreplaceNodeVersion(str){
7-
returnstr.replaceAll(process.version,'*');
8-
}
96

107
functionreplaceStackTrace(str){
118
returnsnapshot.replaceStackTrace(str,'$1at *$7\n');
129
}
1310

1411
describe('console output',{concurrency: true},()=>{
15-
functionstackTrace(str){
16-
returnstr.replaceAll(snapshot.replaceWindowsPaths(process.cwd()),'').replaceAll('/','*').replaceAll(/\d+/g,'*');
12+
functionnormalize(str){
13+
returnstr.replaceAll(snapshot.replaceWindowsPaths(process.cwd()),'').replaceAll('/','*').replaceAll(process.version,'*').replaceAll(/\d+/g,'*');
1714
}
1815
consttests=[
1916
{name: 'console/2100bytes.js'},
@@ -23,7 +20,7 @@ describe('console output', { concurrency: true }, () => {
2320
{
2421
name: 'console/stack_overflow.js',
2522
transform: snapshot
26-
.transform(snapshot.replaceWindowsLineEndings,snapshot.replaceWindowsPaths,replaceNodeVersion,stackTrace)
23+
.transform(snapshot.replaceWindowsLineEndings,snapshot.replaceWindowsPaths,normalize)
2724
},
2825
];
2926
constdefaultTransform=snapshot

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ describe('errors output', { concurrency: true }, () => {
2020
returnnormalize(str).replaceAll(/\d+:\d+/g,'*:*').replaceAll(/:\d+/g,':*').replaceAll('*fixtures*message*','*');
2121
}
2222
constcommon=snapshot
23-
.transform(snapshot.replaceWindowsLineEndings,snapshot.replaceWindowsPaths,replaceNodeVersion);
24-
constdefaultTransform=snapshot.transform(common,normalize);
25-
consterrTransform=snapshot.transform(common,normalizeNoNumbers);
26-
constpromiseTransform=snapshot.transform(common,replaceStackTrace,normalizeNoNumbers);
23+
.transform(snapshot.replaceWindowsLineEndings,snapshot.replaceWindowsPaths);
24+
constdefaultTransform=snapshot.transform(common,normalize,replaceNodeVersion);
25+
consterrTransform=snapshot.transform(common,normalizeNoNumbers,replaceNodeVersion);
26+
constpromiseTransform=snapshot.transform(common,replaceStackTrace,normalizeNoNumbers,replaceNodeVersion);
2727

2828
consttests=[
2929
{name: 'errors/async_error_eval_cjs.js'},

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('sourcemaps output', { concurrency: true }, () => {
2525
returnresult;
2626
}
2727
constdefaultTransform=snapshot
28-
.transform(snapshot.replaceWindowsLineEndings,snapshot.replaceWindowsPaths,replaceNodeVersion,normalize);
28+
.transform(snapshot.replaceWindowsLineEndings,snapshot.replaceWindowsPaths,normalize,replaceNodeVersion);
2929

3030
consttests=[
3131
{name: 'source-map/output/source_map_disabled_by_api.js'},

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('vm output', { concurrency: true }, () => {
1313
}
1414

1515
constdefaultTransform=snapshot
16-
.transform(snapshot.replaceWindowsLineEndings,snapshot.replaceWindowsPaths,replaceNodeVersion,normalize);
16+
.transform(snapshot.replaceWindowsLineEndings,snapshot.replaceWindowsPaths,normalize,replaceNodeVersion);
1717

1818
consttests=[
1919
{name: 'vm/vm_caught_custom_runtime_error.js'},

0 commit comments

Comments
 (0)