Skip to content

Commit

Permalink
test: make test-node-output-v8-warning more flexible
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Oct 16, 2024
1 parent 2cec716 commit 0e9b98d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/parallel/test-node-output-v8-warning.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ 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()), '')
Expand All @@ -15,10 +21,9 @@ describe('v8 output', { concurrency: !process.env.TEST_PARALLEL }, () => {
.replaceAll('*test*', '*')
.replaceAll(/.*?\*fixtures\*v8\*/g, '(node:*) V8: *') // Replace entire path before fixtures/v8
.replaceAll('*fixtures*v8*', '*')

Check failure on line 23 in test/parallel/test-node-output-v8-warning.mjs

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Missing semicolon
.replaceAll('node --', '* --');
}
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

0 comments on commit 0e9b98d

Please sign in to comment.