-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58a7b00
commit 8705725
Showing
5 changed files
with
76 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import '../common/index.mjs'; | ||
import assert from 'node:assert'; | ||
|
||
{ | ||
try { | ||
import.meta.require('does-not-exist'); | ||
assert.fail(); | ||
} catch (e) { | ||
assert.strictEqual(e.code, 'MODULE_NOT_FOUND'); | ||
} | ||
} | ||
|
||
{ | ||
// Require a built-in module | ||
const requiredAssert = import.meta.require('node:assert'); | ||
assert.deepStrictEqual(assert, requiredAssert); | ||
} | ||
|
||
{ | ||
// Require a esm module | ||
const { foo, bar } = import.meta.require('../fixtures/es-module-loaders/module-named-exports.mjs'); | ||
assert.strictEqual(foo, 'foo'); | ||
assert.strictEqual(bar, 'bar'); | ||
} | ||
|
||
{ | ||
const { foo, bar } = import.meta.require('../fixtures/es-modules/cjs-module-exports.js'); | ||
assert.strictEqual(foo, 'foo'); | ||
assert.strictEqual(bar, 'bar'); | ||
} |
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,4 @@ | ||
module.exports = { | ||
foo: 'foo', | ||
bar: 'bar' | ||
} |