forked from aws-amplify/amplify-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…entify the nodejs environment. (aws-amplify#4611) * fixes aws-amplify#4243 aws-amplify#4576 aws-amplify#4599 Correctly identify the nodejs environment. * Fix typo in function signature * Revert back the function type from arrow function to traditional one * Add unit tests to test the runtime environment detection on built bundles * Fix a small typo Co-authored-by: Eric Clemmons <[email protected]>
- Loading branch information
1 parent
bc8ae26
commit 52bd287
Showing
3 changed files
with
53 additions
and
8 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,18 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
|
||
/** The doc block above is to change the running environment of Jest to | ||
* jsdom (which is also the default) Since this is allowed per test file | ||
* and not per test or describe, we have two tests, one for node and other for browser | ||
*/ | ||
import * as core from '../dist/aws-amplify-core.js'; | ||
|
||
describe('JS browserOrNode build test', () => { | ||
test('when its browser ', () => { | ||
expect(core.JS.browserOrNode()).toStrictEqual({ | ||
isBrowser: true, | ||
isNode: 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 @@ | ||
/** | ||
* @jest-environment node | ||
*/ | ||
|
||
/** The doc block above is to change the running environment of Jest to node. | ||
* Since this is allowed per test file and not per test or describe, we have | ||
* two tests, one for node and other for browser | ||
*/ | ||
import * as core from '../dist/aws-amplify-core.js'; | ||
|
||
describe('JS build test', () => { | ||
test('when its node ', () => { | ||
expect(core.JS.browserOrNode()).toStrictEqual({ | ||
isBrowser: false, | ||
isNode: true, | ||
}); | ||
}); | ||
}); |
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