|
1 | 1 | import * as fixtures from '../common/fixtures.mjs'; |
2 | 2 | import * as snapshot from '../common/assertSnapshot.js'; |
3 | 3 | import { describe, it } from 'node:test'; |
4 | | -import { basename } from 'node:path'; |
5 | | -import { pathToFileURL } from 'node:url'; |
6 | 4 |
|
7 | 5 | 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 | | - |
24 | 6 | 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 }, |
27 | 9 | ]; |
28 | 10 |
|
29 | 11 | for (const { name, transform } of tests) { |
|
0 commit comments