Make it possible to run test suite with and without sync

This commit is contained in:
Søren Vind 2016-11-09 12:50:19 -08:00
parent 049db589a8
commit f8eba17c48
4 changed files with 51 additions and 19 deletions

View File

@ -184,10 +184,22 @@ case "$TARGET" in
pushd "$SRCROOT/tests" pushd "$SRCROOT/tests"
npm install npm install
npm test npm run test
popd popd
stop_server stop_server
;; ;;
"node-nosync")
npm install --build-from-source
# Change to a temp directory.
cd "$(mktemp -q -d -t realm.node.XXXXXX)"
trap "rm -rf '$PWD'" EXIT
pushd "$SRCROOT/tests"
npm install
npm run test-nosync
popd
;;
"test-runners") "test-runners")
npm install --build-from-source npm install --build-from-source
@ -221,7 +233,7 @@ case "$TARGET" in
pushd "$SRCROOT/tests" pushd "$SRCROOT/tests"
npm install npm install
npm run test-sync npm run test-sync-integration
popd popd
;; ;;
*) *)

View File

@ -13,8 +13,9 @@
"url-parse": "^1.1.7" "url-parse": "^1.1.7"
}, },
"scripts": { "scripts": {
"test": "jasmine spec/unit_tests.js", "test": "jasmine spec/unit_tests.js spec/sync_tests.js",
"test-sync": "jasmine spec/sync_integration_tests.js", "test-nosync": "jasmine spec/unit_tests.js",
"test-sync-integration": "jasmine spec/sync_integration_tests.js",
"postinstall": "rm -f node_modules/realm && ln -s ../.. node_modules/realm" "postinstall": "rm -f node_modules/realm && ln -s ../.. node_modules/realm"
} }
} }

34
tests/spec/sync_tests.js Normal file
View File

@ -0,0 +1,34 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
/* eslint-env es6, node */
/* eslint-disable no-console */
'use strict';
const Realm = require('realm');
const userTests = require('../js/user-tests');
describe('SyncTests', () => {
beforeEach(() => Realm.clearTestState());
afterEach(() => Realm.clearTestState());
for (const testName in userTests) {
it(testName, (done) => userTests[testName]().catch((e) => fail(e)).then(done));
}
});

View File

@ -76,18 +76,3 @@ describe('AsyncTests', () => {
afterEach(() => Realm.clearTestState()); afterEach(() => Realm.clearTestState());
}); });
const wn = require("child_process").spawn;
const terminate = require("terminate");
const readline = require("readline");
const tmp = require("tmp");
const userTests = require('../js/user-tests');
describe('SyncTests', () => {
beforeEach(() => Realm.clearTestState());
afterEach(() => Realm.clearTestState());
for (const testName in userTests) {
it(testName, (done) => userTests[testName]().catch((e) => fail(e)).then(done));
}
});