mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
test: fix output tests when path includes node version
PR-URL: https://github.com/nodejs/node/pull/47843 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit is contained in:
1 parent
c542d3a1d3
commit
03db04924f
4 files changed
+9
-12
No files matched your search
@@ -3,17 +3,14 @@ import * as fixtures from '../common/fixtures.mjs';
|
||||
import * as snapshot from '../common/assertSnapshot.js';
|
||||
import { describe, it } from 'node:test';
|
||||
|
||||
function replaceNodeVersion(str) {
|
||||
return str.replaceAll(process.version, '*');
|
||||
}
|
||||
|
||||
function replaceStackTrace(str) {
|
||||
return snapshot.replaceStackTrace(str, '$1at *$7\n');
|
||||
}
|
||||
|
||||
describe('console output', { concurrency: true }, () => {
|
||||
function stackTrace(str) {
|
||||
return str.replaceAll(snapshot.replaceWindowsPaths(process.cwd()), '').replaceAll('/', '*').replaceAll(/\d+/g, '*');
|
||||
function normalize(str) {
|
||||
return str.replaceAll(snapshot.replaceWindowsPaths(process.cwd()), '').replaceAll('/', '*').replaceAll(process.version, '*').replaceAll(/\d+/g, '*');
|
||||
}
|
||||
const tests = [
|
||||
{ name: 'console/2100bytes.js' },
|
||||
@@ -23,7 +20,7 @@ describe('console output', { concurrency: true }, () => {
|
||||
{
|
||||
name: 'console/stack_overflow.js',
|
||||
transform: snapshot
|
||||
.transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, replaceNodeVersion, stackTrace)
|
||||
.transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, normalize)
|
||||
},
|
||||
];
|
||||
const defaultTransform = snapshot
|
||||
|
||||
@@ -20,10 +20,10 @@ describe('errors output', { concurrency: true }, () => {
|
||||
return normalize(str).replaceAll(/\d+:\d+/g, '*:*').replaceAll(/:\d+/g, ':*').replaceAll('*fixtures*message*', '*');
|
||||
}
|
||||
const common = snapshot
|
||||
.transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, replaceNodeVersion);
|
||||
const defaultTransform = snapshot.transform(common, normalize);
|
||||
const errTransform = snapshot.transform(common, normalizeNoNumbers);
|
||||
const promiseTransform = snapshot.transform(common, replaceStackTrace, normalizeNoNumbers);
|
||||
.transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths);
|
||||
const defaultTransform = snapshot.transform(common, normalize, replaceNodeVersion);
|
||||
const errTransform = snapshot.transform(common, normalizeNoNumbers, replaceNodeVersion);
|
||||
const promiseTransform = snapshot.transform(common, replaceStackTrace, normalizeNoNumbers, replaceNodeVersion);
|
||||
|
||||
const tests = [
|
||||
{ name: 'errors/async_error_eval_cjs.js' },
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('sourcemaps output', { concurrency: true }, () => {
|
||||
return result;
|
||||
}
|
||||
const defaultTransform = snapshot
|
||||
.transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, replaceNodeVersion, normalize);
|
||||
.transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, normalize, replaceNodeVersion);
|
||||
|
||||
const tests = [
|
||||
{ name: 'source-map/output/source_map_disabled_by_api.js' },
|
||||
|
||||
@@ -13,7 +13,7 @@ describe('vm output', { concurrency: true }, () => {
|
||||
}
|
||||
|
||||
const defaultTransform = snapshot
|
||||
.transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, replaceNodeVersion, normalize);
|
||||
.transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, normalize, replaceNodeVersion);
|
||||
|
||||
const tests = [
|
||||
{ name: 'vm/vm_caught_custom_runtime_error.js' },
|
||||
|
||||
Reference in new issue
Block a user