-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
esm: increase test coverage of edge cases
PR-URL: #47033 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Jacob Smith <[email protected]>
- Loading branch information
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { strictEqual } from "node:assert"; | ||
import { isMainThread, workerData, parentPort } from "node:worker_threads"; | ||
|
||
// TODO(aduh95): switch this to `false` when loader hooks are run on a separate thread. | ||
strictEqual(isMainThread, true); | ||
|
||
// We want to make sure that internals are not leaked on the public module: | ||
strictEqual(workerData, null); | ||
strictEqual(parentPort, null); | ||
|
||
// TODO(aduh95): switch to `"undefined"` when loader hooks are run on a separate thread. | ||
// We don't want `import.meta.resolve` being available from loaders | ||
// as the sync implementation is not compatible with calling async | ||
// functions on the same thread. | ||
strictEqual(typeof import.meta.resolve, 'function'); |
5 changes: 5 additions & 0 deletions
5
test/fixtures/es-module-loaders/never-settling-resolve-step/import.meta.never-resolve.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
console.log('should be output'); | ||
|
||
await import.meta.resolve('never-settle-resolve'); | ||
|
||
console.log('should not be output'); |