GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: refactor `test-node-output-errors` · nodejs/node@b3a7427

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-node-output-errors.mjs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-node-output-errors.mjs
+13-6Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as fixtures from '../common/fixtures.mjs';
33
import * as snapshot from '../common/assertSnapshot.js';
44
import * as os from 'node:os';
55
import { describe, it } from 'node:test';
6+
import { pathToFileURL } from 'node:url';
67

78
const skipForceColors =
89
process.config.variables.icu_gyp_path !== 'tools/icu/icu-generic.gyp' ||
@@ -20,7 +21,13 @@ function replaceStackTrace(str) {
2021

2122
describe('errors output', { concurrency: true }, () => {
2223
function normalize(str) {
23-
return str.replaceAll(snapshot.replaceWindowsPaths(process.cwd()), '').replaceAll('//', '*').replaceAll(/\/(\w)/g, '*$1').replaceAll('*test*', '*').replaceAll('*fixtures*errors*', '*').replaceAll('file:**', 'file:*/');
24+
return str.replaceAll(snapshot.replaceWindowsPaths(process.cwd()), '')
25+
.replaceAll(pathToFileURL(process.cwd()).pathname, '')
26+
.replaceAll('//', '*')
27+
.replaceAll(/\/(\w)/g, '*$1')
28+
.replaceAll('*test*', '*')
29+
.replaceAll('*fixtures*errors*', '*')
30+
.replaceAll('file:**', 'file:*/');
2431
}
2532

2633
function normalizeNoNumbers(str) {
@@ -50,11 +57,11 @@ describe('errors output', { concurrency: true }, () => {
5057
{ name: 'errors/throw_in_line_with_tabs.js', transform: errTransform },
5158
{ name: 'errors/throw_non_error.js', transform: errTransform },
5259
{ name: 'errors/promise_always_throw_unhandled.js', transform: promiseTransform },
53-
!skipForceColors ? { name: 'errors/force_colors.js', env: { FORCE_COLOR: 1 } } : null,
54-
].filter(Boolean);
55-
for (const { name, transform, env } of tests) {
56-
it(name, async () => {
57-
await snapshot.spawnAndAssert(fixtures.path(name), transform ?? defaultTransform, { env });
60+
{ skip: skipForceColors, name: 'errors/force_colors.js', env: { FORCE_COLOR: 1 } },
61+
];
62+
for (const { name, transform = defaultTransform, env, skip = false } of tests) {
63+
it(name, { skip }, async () => {
64+
await snapshot.spawnAndAssert(fixtures.path(name), transform, { env });
5865
});
5966
}
6067
});

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.