-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Support --require of ESM; closes #4281 Allow files/modules specified in `--require` to be ESM. CommonJS loading is still supported and the default. * Conditionally generate url for import Windows compatible * Add tests for --require ESM As both .mjs and type=module (combined with cjs for good measure). Updated linter to allow tests to use spread operator (ecmaVersion 2018) Allow --require'd module to be an object, or "module" * Revert change to eslintrc, use mocha to pass experimental flag * Replace type() -> typeof Add truthy check to handle null edge case type(ES Module) => "module", but we treat it the same as an object * Remove doc limitation for --require ESM * Add note to --require docs about ESM support
- Loading branch information
Showing
7 changed files
with
84 additions
and
13 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
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 @@ | ||
{ "type": "module" } |
8 changes: 8 additions & 0 deletions
8
test/integration/fixtures/options/require/esm/root-hook-defs-esm.fixture.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,8 @@ | ||
export const mochaHooks = () => ({ | ||
beforeEach() { | ||
console.log('esm beforeEach'); | ||
}, | ||
afterEach() { | ||
console.log('esm afterEach'); | ||
}, | ||
}); |
8 changes: 8 additions & 0 deletions
8
test/integration/fixtures/options/require/root-hook-defs-esm.fixture.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,8 @@ | ||
export const mochaHooks = { | ||
beforeAll() { | ||
console.log('mjs beforeAll'); | ||
}, | ||
afterAll() { | ||
console.log('mjs afterAll'); | ||
}, | ||
}; |
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