Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test_runner: use paths for test locations
This commit transforms test locations to paths when V8 provides
file URLs (which seems to be for ESM files).

Fixes: #51610
PR-URL: #52010
Fixes: #51392
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
  • Loading branch information
cjihrig authored and MoLow committed May 7, 2024
commit 2eac41318bbdec715e980cc65c54c23f7ec8e989
6 changes: 6 additions & 0 deletions lib/internal/test_runner/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const {
PromisePrototypeThen,
PromiseResolve,
SafePromisePrototypeFinally,
StringPrototypeStartsWith,
ReflectApply,
RegExpPrototypeExec,
SafeMap,
Expand Down Expand Up @@ -58,6 +59,7 @@ const {
} = require('internal/validators');
const { setTimeout } = require('timers');
const { TIMEOUT_MAX } = require('internal/timers');
const { fileURLToPath } = require('internal/url');
const { availableParallelism } = require('os');
const { bigint: hrtime } = process.hrtime;
const kCallbackAndPromisePresent = 'callbackAndPromisePresent';
Expand Down Expand Up @@ -385,6 +387,10 @@ class Test extends AsyncResource {
this.loc.file = entry.originalSource;
}
}

if (StringPrototypeStartsWith(this.loc.file, 'file://')) {
this.loc.file = fileURLToPath(this.loc.file);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ TAP version 13
not ok 1 - fails
---
duration_ms: *
location: 'file:///test/fixtures/test-runner/output/source_mapped_locations.ts:5:1'
location: '/test/fixtures/test-runner/output/source_mapped_locations.ts:5:1'
failureType: 'testCodeFailure'
error: |-
Expected values to be strictly equal:
Expand Down