-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
module: add 'webassembly' and 'javascript' types
- Loading branch information
1 parent
ba05dd9
commit 4ff88dc
Showing
13 changed files
with
272 additions
and
35 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 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
95 changes: 95 additions & 0 deletions
95
test/es-module/test-esm-assertionless-javascript-import.js
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,95 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const { strictEqual } = require('assert'); | ||
|
||
async function test() { | ||
{ | ||
const [secret0, secret1] = await Promise.all([ | ||
import('../fixtures/es-modules/default-export.mjs'), | ||
import( | ||
'../fixtures/es-modules/default-export.mjs', | ||
{ assert: { type: 'javascript' } } | ||
), | ||
]); | ||
|
||
strictEqual(secret0.default.ofLife, 42); | ||
strictEqual(secret1.default.ofLife, 42); | ||
strictEqual(secret0.default, secret1.default); | ||
strictEqual(secret0, secret1); | ||
} | ||
|
||
{ | ||
const [secret0, secret1] = await Promise.all([ | ||
import( | ||
'../fixtures/es-modules/default-export.mjs', | ||
{ assert: { type: 'javascript' } } | ||
), | ||
import('../fixtures/es-modules/default-export.mjs'), | ||
]); | ||
|
||
strictEqual(secret0.default.ofLife, 42); | ||
strictEqual(secret1.default.ofLife, 42); | ||
strictEqual(secret0.default, secret1.default); | ||
strictEqual(secret0, secret1); | ||
} | ||
|
||
{ | ||
const [secret0, secret1] = await Promise.all([ | ||
import('../fixtures/es-modules/default-export.mjs?test'), | ||
import( | ||
'../fixtures/es-modules/default-export.mjs?test', | ||
{ assert: { type: 'javascript' } } | ||
), | ||
]); | ||
|
||
strictEqual(secret0.default.ofLife, 42); | ||
strictEqual(secret1.default.ofLife, 42); | ||
strictEqual(secret0.default, secret1.default); | ||
strictEqual(secret0, secret1); | ||
} | ||
|
||
{ | ||
const [secret0, secret1] = await Promise.all([ | ||
import('../fixtures/es-modules/default-export.mjs#test'), | ||
import( | ||
'../fixtures/es-modules/default-export.mjs#test', | ||
{ assert: { type: 'javascript' } } | ||
), | ||
]); | ||
|
||
strictEqual(secret0.default.ofLife, 42); | ||
strictEqual(secret1.default.ofLife, 42); | ||
strictEqual(secret0.default, secret1.default); | ||
strictEqual(secret0, secret1); | ||
} | ||
|
||
{ | ||
const [secret0, secret1] = await Promise.all([ | ||
import('../fixtures/es-modules/default-export.mjs?test2#test'), | ||
import( | ||
'../fixtures/es-modules/default-export.mjs?test2#test', | ||
{ assert: { type: 'javascript' } } | ||
), | ||
]); | ||
|
||
strictEqual(secret0.default.ofLife, 42); | ||
strictEqual(secret1.default.ofLife, 42); | ||
strictEqual(secret0.default, secret1.default); | ||
strictEqual(secret0, secret1); | ||
} | ||
|
||
{ | ||
const [secret0, secret1] = await Promise.all([ | ||
import('data:text/javascript,export default { ofLife: 42 }'), | ||
import( | ||
'data:text/javascript,export default { ofLife: 42 }', | ||
{ assert: { type: 'javascript' } } | ||
), | ||
]); | ||
|
||
strictEqual(secret0.default.ofLife, 42); | ||
strictEqual(secret1.default.ofLife, 42); | ||
} | ||
} | ||
|
||
test().then(common.mustCall()); |
90 changes: 90 additions & 0 deletions
90
test/es-module/test-esm-assertionless-javascript-import.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,90 @@ | ||
import '../common/index.mjs'; | ||
import { strictEqual } from 'assert'; | ||
|
||
{ | ||
const [secret0, secret1] = await Promise.all([ | ||
import('../fixtures/es-modules/default-export.mjs'), | ||
import( | ||
'../fixtures/es-modules/default-export.mjs', | ||
{ assert: { type: 'javascript' } } | ||
), | ||
]); | ||
|
||
strictEqual(secret0.default.ofLife, 42); | ||
strictEqual(secret1.default.ofLife, 42); | ||
strictEqual(secret0.default, secret1.default); | ||
strictEqual(secret0, secret1); | ||
} | ||
|
||
{ | ||
const [secret0, secret1] = await Promise.all([ | ||
import( | ||
'../fixtures/es-modules/default-export.mjs', | ||
{ assert: { type: 'javascript' } } | ||
), | ||
import('../fixtures/es-modules/default-export.mjs'), | ||
]); | ||
|
||
strictEqual(secret0.default.ofLife, 42); | ||
strictEqual(secret1.default.ofLife, 42); | ||
strictEqual(secret0.default, secret1.default); | ||
strictEqual(secret0, secret1); | ||
} | ||
|
||
{ | ||
const [secret0, secret1] = await Promise.all([ | ||
import('../fixtures/es-modules/default-export.mjs?test'), | ||
import( | ||
'../fixtures/es-modules/default-export.mjs?test', | ||
{ assert: { type: 'javascript' } } | ||
), | ||
]); | ||
|
||
strictEqual(secret0.default.ofLife, 42); | ||
strictEqual(secret1.default.ofLife, 42); | ||
strictEqual(secret0.default, secret1.default); | ||
strictEqual(secret0, secret1); | ||
} | ||
|
||
{ | ||
const [secret0, secret1] = await Promise.all([ | ||
import('../fixtures/es-modules/default-export.mjs#test'), | ||
import( | ||
'../fixtures/es-modules/default-export.mjs#test', | ||
{ assert: { type: 'javascript' } } | ||
), | ||
]); | ||
|
||
strictEqual(secret0.default.ofLife, 42); | ||
strictEqual(secret1.default.ofLife, 42); | ||
strictEqual(secret0.default, secret1.default); | ||
strictEqual(secret0, secret1); | ||
} | ||
|
||
{ | ||
const [secret0, secret1] = await Promise.all([ | ||
import('../fixtures/es-modules/default-export.mjs?test2#test'), | ||
import( | ||
'../fixtures/es-modules/default-export.mjs?test2#test', | ||
{ assert: { type: 'javascript' } } | ||
), | ||
]); | ||
|
||
strictEqual(secret0.default.ofLife, 42); | ||
strictEqual(secret1.default.ofLife, 42); | ||
strictEqual(secret0.default, secret1.default); | ||
strictEqual(secret0, secret1); | ||
} | ||
|
||
{ | ||
const [secret0, secret1] = await Promise.all([ | ||
import('data:text/javascript,export default { ofLife: 42 }'), | ||
import( | ||
'data:text/javascript,export default { ofLife: 42 }', | ||
{ assert: { type: 'javascript' } } | ||
), | ||
]); | ||
|
||
strictEqual(secret0.default.ofLife, 42); | ||
strictEqual(secret1.default.ofLife, 42); | ||
} |
Oops, something went wrong.