Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1b84e85

Browse filesBrowse 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
Copy full SHA for 1b84e85

File tree

Expand file treeCollapse file tree

4 files changed

+9
-12
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+9
-12
lines changed
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-node-output-console.mjs
+3-6Lines 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 * as snapshot from '../common/assertSnapshot.js';
44
import { describe, it } from 'node:test';
55

6-
function replaceNodeVersion(str) {
7-
return str.replaceAll(process.version, '*');
8-
}
96

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

1411
describe('console output', { concurrency: true }, () => {
15-
function stackTrace(str) {
16-
return str.replaceAll(snapshot.replaceWindowsPaths(process.cwd()), '').replaceAll('/', '*').replaceAll(/\d+/g, '*');
12+
function normalize(str) {
13+
return str.replaceAll(snapshot.replaceWindowsPaths(process.cwd()), '').replaceAll('/', '*').replaceAll(process.version, '*').replaceAll(/\d+/g, '*');
1714
}
1815
const tests = [
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
const defaultTransform = snapshot
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-node-output-errors.mjs
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ describe('errors output', { concurrency: true }, () => {
2020
return normalize(str).replaceAll(/\d+:\d+/g, '*:*').replaceAll(/:\d+/g, ':*').replaceAll('*fixtures*message*', '*');
2121
}
2222
const common = snapshot
23-
.transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, replaceNodeVersion);
24-
const defaultTransform = snapshot.transform(common, normalize);
25-
const errTransform = snapshot.transform(common, normalizeNoNumbers);
26-
const promiseTransform = snapshot.transform(common, replaceStackTrace, normalizeNoNumbers);
23+
.transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths);
24+
const defaultTransform = snapshot.transform(common, normalize, replaceNodeVersion);
25+
const errTransform = snapshot.transform(common, normalizeNoNumbers, replaceNodeVersion);
26+
const promiseTransform = snapshot.transform(common, replaceStackTrace, normalizeNoNumbers, replaceNodeVersion);
2727

2828
const tests = [
2929
{ name: 'errors/async_error_eval_cjs.js' },
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-node-output-sourcemaps.mjs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('sourcemaps output', { concurrency: true }, () => {
2525
return result;
2626
}
2727
const defaultTransform = snapshot
28-
.transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, replaceNodeVersion, normalize);
28+
.transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, normalize, replaceNodeVersion);
2929

3030
const tests = [
3131
{ name: 'source-map/output/source_map_disabled_by_api.js' },
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-node-output-vm.mjs
+1-1Lines 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
const defaultTransform = snapshot
16-
.transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, replaceNodeVersion, normalize);
16+
.transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, normalize, replaceNodeVersion);
1717

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.