Skip to content

Commit 8634e05

Browse files
codebytereaduh95
authored andcommitted
test: make test-node-output-v8-warning more flexible
PR-URL: #55401 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
1 parent 2ac2c5a commit 8634e05

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎test/parallel/test-node-output-v8-warning.mjs‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,28 @@ import '../common/index.mjs';
22
import*asfixturesfrom'../common/fixtures.mjs';
33
import*assnapshotfrom'../common/assertSnapshot.js';
44
import{describe,it}from'node:test';
5+
import{basename}from'node:path';
56

67
functionreplaceNodeVersion(str){
78
returnstr.replaceAll(process.version,'*');
89
}
910

11+
functionreplaceExecName(str){
12+
constbaseName=basename(process.argv0||'node','.exe');
13+
returnstr.replaceAll(`${baseName} --`,'* --');
14+
}
15+
1016
describe('v8 output',{concurrency: !process.env.TEST_PARALLEL},()=>{
1117
functionnormalize(str){
1218
returnstr.replaceAll(snapshot.replaceWindowsPaths(process.cwd()),'')
1319
.replaceAll(/:\d+/g,':*')
1420
.replaceAll('/','*')
1521
.replaceAll('*test*','*')
1622
.replaceAll(/.*?\*fixtures\*v8\*/g,'(node:*) V8: *')// Replace entire path before fixtures/v8
17-
.replaceAll('*fixtures*v8*','*')
18-
.replaceAll('node --','* --');
23+
.replaceAll('*fixtures*v8*','*');
1924
}
2025
constcommon=snapshot
21-
.transform(snapshot.replaceWindowsLineEndings,snapshot.replaceWindowsPaths,replaceNodeVersion);
26+
.transform(snapshot.replaceWindowsLineEndings,snapshot.replaceWindowsPaths,replaceNodeVersion,replaceExecName);
2227
constdefaultTransform=snapshot.transform(common,normalize);
2328
consttests=[
2429
{name: 'v8/v8_warning.js'},

0 commit comments

Comments
 (0)