-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add modulesWithSideEffectsInSrcFiles to allow esm in srcFiles
- Loading branch information
1 parent
4308a48
commit 07370ae
Showing
10 changed files
with
69 additions
and
3 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
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,4 @@ | ||
it('verifies that ES modules in sources are automatically loaded in the correct order', function() { | ||
expect(window._moduleWithSyncSideEffectLoaded).withContext('window._moduleWithSyncSideEffectLoaded').toBe(true); | ||
expect(window._scriptSyncSuccess).withContext('window._scriptSyncSuccess').toBe(true); | ||
}); |
16 changes: 16 additions & 0 deletions
16
spec/fixtures/modulesWithSideEffectsInSrcFiles/spec/support/jasmine-browser.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,16 @@ | ||
module.exports = { | ||
"srcDir": "src", | ||
"srcFiles": [ | ||
"moduleWithSideEffects.mjs", | ||
"scriptNeedsSideEffect.js" | ||
], | ||
"specDir": "spec", | ||
"specFiles": [ | ||
"aSpec.js" | ||
], | ||
"random": false, | ||
"modulesWithSideEffectsInSrcFiles": true, | ||
"browser": { | ||
"name": "headlessChrome" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
spec/fixtures/modulesWithSideEffectsInSrcFiles/src/moduleWithSideEffects.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 @@ | ||
window._moduleWithSyncSideEffectLoaded = true; |
5 changes: 5 additions & 0 deletions
5
spec/fixtures/modulesWithSideEffectsInSrcFiles/src/scriptNeedsSideEffect.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,5 @@ | ||
if(window._moduleWithSyncSideEffectLoaded) { | ||
window._scriptSyncSuccess = true; | ||
}else{ | ||
window._scriptSyncSuccess = false; | ||
} |
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,18 @@ | ||
const { | ||
runJasmine, | ||
expectSuccess, | ||
timeoutMs, | ||
} = require('./integrationSupport'); | ||
|
||
describe('ESM in Specs', function() { | ||
it( | ||
'optionally loads ESM files in spec', | ||
async function() { | ||
const result = await runJasmine( | ||
'spec/fixtures/modulesWithSideEffectsInSrcFiles' | ||
); | ||
expectSuccess(result, '1 spec, 0 failures'); | ||
}, | ||
timeoutMs | ||
); | ||
}); |