This repository has been archived by the owner on Apr 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add additional fixtures and tests for irp
- Loading branch information
1 parent
0c15920
commit 6c03eed
Showing
11 changed files
with
93 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Flags: --experimental-modules | ||
/* eslint-disable node-core/required-modules */ | ||
|
||
import '../common/index.mjs'; | ||
import assert from 'assert'; | ||
|
||
import legacyLoader from '../fixtures/esm-package-scope/legacy-loader/index.mjs'; | ||
import newLoader from '../fixtures/esm-package-scope/new-loader/index.js'; | ||
|
||
assert.strictEqual(legacyLoader, 'legacy-loader'); | ||
assert.strictEqual(newLoader, 'new-loader'); |
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 @@ | ||
module.exports = 'a'; |
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 const b = 'b'; |
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,5 @@ | ||
module.exports = { | ||
one: 1, | ||
two: 2, | ||
three: 3 | ||
}; |
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,21 @@ | ||
// js file that is common.js | ||
import a from './a.js'; | ||
// ESM with named export | ||
import {b} from './b.mjs'; | ||
// import 'c.cjs'; | ||
import cjs from './c.cjs'; | ||
// proves cross boundary fun bits | ||
import jsAsEsm from '../new-loader/a.js'; | ||
|
||
// named export from core | ||
import {strictEqual, deepStrictEqual} from 'assert'; | ||
|
||
strictEqual(a, jsAsEsm); | ||
strictEqual(b, 'b'); | ||
deepStrictEqual(cjs, { | ||
one: 1, | ||
two: 2, | ||
three: 3 | ||
}); | ||
|
||
export default 'legacy-loader'; |
13 changes: 13 additions & 0 deletions
13
test/fixtures/esm-package-scope/legacy-loader/package.json
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,13 @@ | ||
{ | ||
"name": "legacy-loader", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "Myles Borins <mylesborins@google.com>", | ||
"license": "Apache-2.0", | ||
"type": "commonjs" | ||
} |
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 default 'a' |
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 const b = 'b'; |
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,5 @@ | ||
module.exports = { | ||
one: 1, | ||
two: 2, | ||
three: 3 | ||
}; |
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,21 @@ | ||
// ESM with only default | ||
import a from './a.js'; | ||
// ESM with named export | ||
import {b} from './b.mjs'; | ||
// import 'c.cjs'; | ||
import cjs from './c.cjs'; | ||
// import across boundaries | ||
import jsAsCjs from '../legacy-loader/a.js' | ||
|
||
// named export from core | ||
import {strictEqual, deepStrictEqual} from 'assert'; | ||
|
||
strictEqual(a, jsAsCjs); | ||
strictEqual(b, 'b'); | ||
deepStrictEqual(cjs, { | ||
one: 1, | ||
two: 2, | ||
three: 3 | ||
}); | ||
|
||
export default 'new-loader'; |
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,13 @@ | ||
{ | ||
"name": "new-loader", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "Myles Borins <mylesborins@google.com>", | ||
"license": "Apache-2.0", | ||
"type": "module" | ||
} |