-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! module: clarify require not defined error message
- Loading branch information
Showing
2 changed files
with
28 additions
and
5 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 |
---|---|---|
@@ -1,9 +1,23 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const fixtures = require('../common/fixtures'); | ||
const assert = require('assert'); | ||
|
||
assert.rejects( | ||
import('data:text/javascript,require;'), | ||
// eslint-disable-next-line node-core/no-unescaped-regexp-dot | ||
/use .await import. instead/ | ||
).then(common.mustCall()); | ||
|
||
assert.rejects( | ||
import('data:text/javascript,require;//.js'), | ||
// eslint-disable-next-line node-core/no-unescaped-regexp-dot | ||
/^(?!It seems you are trying to load a file using `.js` extension).*$/ | ||
).then(common.mustCall()); | ||
|
||
assert.rejects( | ||
import(fixtures.path('/es-modules/package-type-module/cjs.js')), | ||
// eslint-disable-next-line node-core/no-unescaped-regexp-dot | ||
/use the .\.cjs. extension to load the file as a CommonJS module/ | ||
).then(common.mustCall()); | ||
|