-
Notifications
You must be signed in to change notification settings - Fork 28.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
loader: warn when the user imports a module with a thenable namespace
A module with a thenable namespace will most likely make the import fail so warn the user when it happens. As an example, if your entry file imports a thenable namespace and expects to continue execution after getting it, node will currently exit with no message.
- Loading branch information
Showing
4 changed files
with
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
// Flags: --experimental-modules | ||
|
||
const common = require('../common'); | ||
const assert = require('assert'); | ||
|
||
common.crashOnUnhandledRejection(); | ||
|
||
const re = /^The namespace of .+? is thenable\. See https:\/\/mdn\.io\/thenable for more information\.$/; | ||
process.on('warning', common.mustCall((warning) => { | ||
assert(re.test(warning.message)); | ||
})); | ||
|
||
import('../fixtures/es-modules/thenable.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 @@ | ||
export function then() {} |