Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit3af7cfe

Browse files
authored
test: refactortest-node-output-errors
The main reason is to not have the test fail if the CWD contains somespecial URL chars.PR-URL:#48992Reviewed-By: Moshe Atlow <moshe@atlow.co.il>Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
1 parenta061781 commit3af7cfe

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

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

Lines 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*assnapshotfrom'../common/assertSnapshot.js';
44
import*asosfrom'node:os';
55
import{describe,it}from'node:test';
6+
import{pathToFileURL}from'node:url';
67

78
constskipForceColors=
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
functionnormalize(str){
23-
returnstr.replaceAll(snapshot.replaceWindowsPaths(process.cwd()),'').replaceAll('//','*').replaceAll(/\/(\w)/g,'*$1').replaceAll('*test*','*').replaceAll('*fixtures*errors*','*').replaceAll('file:**','file:*/');
24+
returnstr.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
functionnormalizeNoNumbers(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}oftests){
56-
it(name,async()=>{
57-
awaitsnapshot.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}oftests){
63+
it(name,{ skip},async()=>{
64+
awaitsnapshot.spawnAndAssert(fixtures.path(name),transform,{ env});
5865
});
5966
}
6067
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp