Skip to content

Commit c373119

Browse files
authored
test: use snapshot.defaultTransform in test-node-output-util.mjs
1 parent c07c7e4 commit c373119

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

test/parallel/test-node-output-util.mjs

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,11 @@
11
import * as fixtures from '../common/fixtures.mjs';
22
import * as snapshot from '../common/assertSnapshot.js';
33
import { describe, it } from 'node:test';
4-
import { basename } from 'node:path';
5-
import { pathToFileURL } from 'node:url';
64

75
describe('util output', { concurrency: !process.env.TEST_PARALLEL }, () => {
8-
function normalize(str) {
9-
const baseName = basename(process.argv0 || 'node', '.exe');
10-
return str.replaceAll(snapshot.replaceWindowsPaths(process.cwd()), '')
11-
.replaceAll(pathToFileURL(process.cwd()).pathname, '')
12-
.replaceAll('//', '*')
13-
.replaceAll(/\/(\w)/g, '*$1')
14-
.replaceAll('*test*', '*')
15-
.replaceAll('*fixtures*util*', '*')
16-
.replaceAll('file:**', 'file:*/')
17-
.replaceAll(`${baseName} --`, '* --');
18-
}
19-
20-
const commonTransform = snapshot
21-
.transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths);
22-
const defaultTransform = snapshot.transform(commonTransform, normalize, snapshot.replaceNodeVersion);
23-
246
const tests = [
25-
{ name: 'util/util_inspect_error.js', transform: defaultTransform },
26-
{ name: 'util/util-inspect-error-cause.js', transform: defaultTransform },
7+
{ name: 'util/util_inspect_error.js', transform: snapshot.defaultTransform },
8+
{ name: 'util/util-inspect-error-cause.js', transform: snapshot.defaultTransform },
279
];
2810

2911
for (const { name, transform } of tests) {

0 commit comments

Comments
 (0)