Accept a custom path for the realm module (#725)
* Accept a custom path for the realm module * Use the correct argument for the realm module path
This commit is contained in:
parent
87260a42c9
commit
8eb639678e
|
@ -29,7 +29,7 @@ function createNotificationTest(config, getObservable, addListener, removeListen
|
|||
return new Promise((resolve, reject) => {
|
||||
let realm = new Realm(config);
|
||||
let observable = getObservable(realm);
|
||||
let worker = new Worker(__dirname + '/worker-tests-script.js');
|
||||
let worker = new Worker(__dirname + '/worker-tests-script.js', [require.resolve('realm')]);
|
||||
|
||||
// Test will fail if it does not receive a change event within a second.
|
||||
let timer = setTimeout(() => {
|
||||
|
@ -75,8 +75,8 @@ function createNotificationTest(config, getObservable, addListener, removeListen
|
|||
|
||||
function createCollectionChangeTest(config, createCollection, messages, expected, removeAll) {
|
||||
return createNotificationTest(
|
||||
config,
|
||||
createCollection,
|
||||
config,
|
||||
createCollection,
|
||||
(collection, increment, resolve, reject, cleanup) => {
|
||||
var listener = (object, changes) => {
|
||||
try {
|
||||
|
@ -87,7 +87,7 @@ function createCollectionChangeTest(config, createCollection, messages, expected
|
|||
} catch (e) {
|
||||
reject(e);
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
};
|
||||
collection.addListener(listener);
|
||||
return listener;
|
||||
|
@ -117,8 +117,8 @@ module.exports = {
|
|||
testChangeNotifications() {
|
||||
var config = { schema: [schemas.TestObject] };
|
||||
return createNotificationTest(
|
||||
config,
|
||||
(realm) => realm,
|
||||
config,
|
||||
(realm) => realm,
|
||||
(realm, increment, resolve, reject, cleanup) => realm.addListener('change', () => {
|
||||
try {
|
||||
var objects = realm.objects('TestObject');
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const Realm = require('realm');
|
||||
const Realm = require(process.argv[2]);
|
||||
|
||||
process.on('message', (message) => {
|
||||
process.send(handleMessage(message));
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
'use strict';
|
||||
|
||||
class Worker {
|
||||
constructor(script) {
|
||||
this._process = require('child_process').fork(script);
|
||||
constructor(script, args) {
|
||||
this._process = require('child_process').fork(script, args);
|
||||
|
||||
this._process.on('message', (message) => {
|
||||
if (this.onmessage) {
|
||||
|
|
Loading…
Reference in New Issue