Merge pull request #561 from realm/yg/testrunner-tests
Make realm-js usable in some major test runners
This commit is contained in:
commit
b88d8a6359
|
@ -5,3 +5,5 @@
|
|||
build/
|
||||
node_modules/
|
||||
vendor/
|
||||
|
||||
/tests/test-runners/
|
|
@ -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;
|
||||
|
|
|
@ -157,6 +157,18 @@ case "$TARGET" in
|
|||
|
||||
node "$SRCROOT/tests"
|
||||
;;
|
||||
"test-runners")
|
||||
npm install
|
||||
scripts/download-core.sh node
|
||||
src/node/build-node.sh $CONFIGURATION
|
||||
|
||||
for runner in ava mocha jest; do
|
||||
pushd "$SRCROOT/tests/test-runners/$runner"
|
||||
npm install
|
||||
npm test
|
||||
popd
|
||||
done
|
||||
;;
|
||||
"object-store")
|
||||
pushd src/object-store
|
||||
cmake -DCMAKE_BUILD_TYPE=$CONFIGURATION .
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"scripts": {
|
||||
"test": "ava"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^0.16.0"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
import test from 'ava';
|
||||
|
||||
test('can require Realm', t => {
|
||||
var realm = require('realm');
|
||||
t.is('function', typeof realm);
|
||||
t.is('Realm', realm.name);
|
||||
});
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest-cli": "^13.2.3"
|
||||
},
|
||||
"jest": {
|
||||
"testEnvironment": "node",
|
||||
"unmockedModulePathPatterns": [
|
||||
"realm"
|
||||
],
|
||||
"testRegex": "test.js"
|
||||
}
|
||||
}
|
|
@ -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');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "^3.0.2"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
var assert = require('assert');
|
||||
|
||||
describe('Realm', function() {
|
||||
it('should be requirable', function() {
|
||||
var realm = require('realm');
|
||||
assert.equal(typeof realm, 'function');
|
||||
assert.equal(realm.name, 'Realm');
|
||||
});
|
||||
});
|
|
@ -0,0 +1 @@
|
|||
../../..
|
Loading…
Reference in New Issue