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

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

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

67
function replaceNodeVersion(str) {
78
return str.replaceAll(process.version, '*');
89
}
910

11+
function replaceExecName(str) {
12+
const baseName = basename(process.argv0 || 'node', '.exe');
13+
return str.replaceAll(`${baseName} --`, '* --');
14+
}
15+
1016
describe('v8 output', { concurrency: !process.env.TEST_PARALLEL }, () => {
1117
function normalize(str) {
1218
return str.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
const common = snapshot
21-
.transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, replaceNodeVersion);
26+
.transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, replaceNodeVersion, replaceExecName);
2227
const defaultTransform = snapshot.transform(common, normalize);
2328
const tests = [
2429
{ name: 'v8/v8_warning.js' },

0 commit comments

Comments
 (0)