-
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.
module: proxy require('esm') to import('esm')
- Loading branch information
1 parent
38a15d8
commit 4d9aceb
Showing
5 changed files
with
29 additions
and
86 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 was deleted.
Oops, something went wrong.
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,11 +1,16 @@ | ||
'use strict'; | ||
require('../common'); | ||
const {expectWarning} = require('../common'); | ||
const assert = require('assert'); | ||
|
||
assert.throws( | ||
() => require('../fixtures/es-modules/test-esm-ok.mjs'), | ||
{ | ||
message: /Must use import to load ES Module/, | ||
code: 'ERR_REQUIRE_ESM' | ||
} | ||
); | ||
expectWarning('Warning', [ | ||
['Attempting to require and ESModule. Replace `require` with `import`', 'WARN_REQUIRE_ESM'], | ||
['Attempting to require and ESModule. Replace `require` with `import`', 'WARN_REQUIRE_ESM'] | ||
]); | ||
|
||
require('../fixtures/es-modules/test-esm-ok.mjs').then(module => { | ||
assert.ok(module.default); | ||
}); | ||
|
||
require('../fixtures/es-modules/package-type-module').then(module => { | ||
assert.strictEqual(module.default, 'package-type-module'); | ||
}); |