-
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.
module: improve error message for invalid data URL
Fixes: #37647 PR-URL: #37701 Reviewed-By: Derek Lewis <[email protected]> Reviewed-By: Guy Bedford <[email protected]>
- Loading branch information
Showing
3 changed files
with
36 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,24 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
|
||
(async () => { | ||
await assert.rejects(import('data:text/plain,export default0'), { | ||
code: 'ERR_INVALID_MODULE_SPECIFIER', | ||
message: | ||
'Invalid module "data:text/plain,export default0" has an unsupported ' + | ||
'MIME type "text/plain"', | ||
}); | ||
await assert.rejects(import('data:text/plain;base64,'), { | ||
code: 'ERR_INVALID_MODULE_SPECIFIER', | ||
message: | ||
'Invalid module "data:text/plain;base64," has an unsupported ' + | ||
'MIME type "text/plain"', | ||
}); | ||
await assert.rejects(import('data:application/json,[]'), { | ||
code: 'ERR_INVALID_MODULE_SPECIFIER', | ||
message: | ||
'Invalid module "data:application/json,[]" has an unsupported ' + | ||
'MIME type "application/json"', | ||
}); | ||
})().then(common.mustCall()); |