mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-22 04:24:09 +00:00
add support for the jest runner’s node environment
This commit is contained in:
parent
1a98077794
commit
fb7911e3fa
@ -29,7 +29,7 @@ if (typeof Realm != 'undefined') {
|
||||
// The userAgent will be defined when running in a browser (such as Chrome debugging mode).
|
||||
realmConstructor = require('./browser').default; // (exported as ES6 module)
|
||||
// eslint-disable-next-line
|
||||
} else if (typeof process == 'object' && ('' + process) == '[object process]') {
|
||||
} else if (typeof process == 'object' && (('' + process) == '[object process]' || typeof jest == 'object')) {
|
||||
// Prevent React Native packager from seeing this module.
|
||||
var bindings = 'bindings';
|
||||
realmConstructor = require(bindings)('realm').Realm;
|
||||
|
@ -162,7 +162,7 @@ case "$TARGET" in
|
||||
scripts/download-core.sh node
|
||||
src/node/build-node.sh $CONFIGURATION
|
||||
|
||||
for runner in ava mocha; do
|
||||
for runner in ava mocha jest; do
|
||||
pushd "$SRCROOT/tests/test-runners/$runner"
|
||||
npm install
|
||||
npm test
|
||||
|
15
tests/test-runners/jest/package.json
Normal file
15
tests/test-runners/jest/package.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest-cli": "^13.2.3"
|
||||
},
|
||||
"jest": {
|
||||
"testEnvironment": "node",
|
||||
"unmockedModulePathPatterns": [
|
||||
"realm"
|
||||
],
|
||||
"testRegex": "test.js"
|
||||
}
|
||||
}
|
7
tests/test-runners/jest/test.js
Normal file
7
tests/test-runners/jest/test.js
Normal file
@ -0,0 +1,7 @@
|
||||
describe('Realm', function() {
|
||||
it('should be requirable', function() {
|
||||
var realm = require('realm');
|
||||
expect(typeof realm).toBe('function');
|
||||
expect(realm.name).toBe('Realm');
|
||||
});
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user