Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: make test-node-output-v8-warning more flexible #55401

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions test/parallel/test-node-output-v8-warning.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@ import '../common/index.mjs';
import * as fixtures from '../common/fixtures.mjs';
import * as snapshot from '../common/assertSnapshot.js';
import { describe, it } from 'node:test';
import { basename } from 'node:path';

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

function replaceExecName(str) {
const baseName = basename(process.argv0 || 'node', '.exe');
return str.replaceAll(`${baseName} --`, '* --');
}

describe('v8 output', { concurrency: !process.env.TEST_PARALLEL }, () => {
function normalize(str) {
return str.replaceAll(snapshot.replaceWindowsPaths(process.cwd()), '')
.replaceAll(/:\d+/g, ':*')
.replaceAll('/', '*')
.replaceAll('*test*', '*')
.replaceAll(/.*?\*fixtures\*v8\*/g, '(node:*) V8: *') // Replace entire path before fixtures/v8
.replaceAll('*fixtures*v8*', '*')
.replaceAll('node --', '* --');
.replaceAll('*fixtures*v8*', '*');
}
const common = snapshot
.transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, replaceNodeVersion);
.transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, replaceNodeVersion, replaceExecName);
const defaultTransform = snapshot.transform(common, normalize);
const tests = [
{ name: 'v8/v8_warning.js' },
Expand Down
Loading