2021-03-10 22:20:38 +00:00
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const assert = require('assert');
|
|
|
|
|
|
|
|
(async () => {
|
|
|
|
await assert.rejects(import('data:text/plain,export default0'), {
|
2020-11-30 16:03:30 +00:00
|
|
|
code: 'ERR_UNKNOWN_MODULE_FORMAT',
|
|
|
|
message:
|
|
|
|
'Unknown module format: text/plain for URL data:text/plain,' +
|
|
|
|
'export default0',
|
2021-03-10 22:20:38 +00:00
|
|
|
});
|
|
|
|
await assert.rejects(import('data:text/plain;base64,'), {
|
2020-11-30 16:03:30 +00:00
|
|
|
code: 'ERR_UNKNOWN_MODULE_FORMAT',
|
|
|
|
message:
|
|
|
|
'Unknown module format: text/plain for URL data:text/plain;base64,',
|
2021-03-10 22:20:38 +00:00
|
|
|
});
|
2022-01-31 22:16:37 +00:00
|
|
|
await assert.rejects(import('data:text/css,.error { color: red; }'), {
|
2020-11-30 16:03:30 +00:00
|
|
|
code: 'ERR_UNKNOWN_MODULE_FORMAT',
|
|
|
|
message: 'Unknown module format: text/css for URL data:text/css,.error { color: red; }',
|
2021-03-10 22:20:38 +00:00
|
|
|
});
|
2023-08-13 21:24:22 +00:00
|
|
|
await assert.rejects(import('data:WRONGtext/javascriptFORMAT,console.log("hello!");'), {
|
|
|
|
code: 'ERR_UNKNOWN_MODULE_FORMAT',
|
|
|
|
});
|
2021-03-10 22:20:38 +00:00
|
|
|
})().then(common.mustCall());
|