-
Notifications
You must be signed in to change notification settings - Fork 30.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix or skip tests that are not fit for running on worker threads
- Loading branch information
Showing
7 changed files
with
33 additions
and
22 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
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
// Flags: --import ./test/fixtures/es-module-loaders/builtin-named-exports.mjs | ||
import '../common/index.mjs'; | ||
import { readFile, __fromLoader } from 'fs'; | ||
import { skipIfWorker } from '../common/index.mjs'; | ||
import * as fs from 'fs'; | ||
import assert from 'assert'; | ||
import ok from '../fixtures/es-modules/test-esm-ok.mjs'; | ||
skipIfWorker(); | ||
|
||
assert(ok); | ||
assert(readFile); | ||
assert(__fromLoader); | ||
assert(fs.readFile); | ||
assert(fs.__fromLoader); |
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
17 changes: 7 additions & 10 deletions
17
test/fixtures/es-module-loaders/not-found-assert-loader.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 |
---|---|---|
@@ -1,16 +1,13 @@ | ||
import assert from 'node:assert'; | ||
|
||
// A loader that asserts that the defaultResolve will throw "not found" | ||
// (skipping the top-level main of course, and the built-in ones needed for run-worker). | ||
let mainLoad = true; | ||
export async function resolve(specifier, { importAttributes }, next) { | ||
if (mainLoad || specifier === 'path' || specifier === 'worker_threads') { | ||
mainLoad = false; | ||
return next(specifier); | ||
if (specifier.startsWith('./not-found')) { | ||
await assert.rejects(next(specifier), { code: 'ERR_MODULE_NOT_FOUND' }); | ||
return { | ||
url: 'node:fs', | ||
importAttributes, | ||
}; | ||
} | ||
await assert.rejects(next(specifier), { code: 'ERR_MODULE_NOT_FOUND' }); | ||
return { | ||
url: 'node:fs', | ||
importAttributes, | ||
}; | ||
return next(specifier); | ||
} |