Skip to content

Commit 5b8910e

Browse files
committed
Run Package tests just in Node env
That's where we'll see missing dependencies errors
1 parent 3900627 commit 5b8910e

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

test/v1/package.test.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,29 @@
1919

2020
var path = require('path');
2121
var os = require('os');
22-
var neo4jReq = require(path.join(os.tmpdir(), 'sandbox', 'node_modules', 'neo4j-driver', 'lib'));
22+
var NodeChannel = require('../../lib/v1/internal/ch-node').default;
2323

2424
describe('Package', function() {
25-
26-
var driverGlobal, originalTimeout;
27-
28-
beforeAll(function () {
29-
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
30-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
31-
32-
var neo4j = neo4jReq.v1;
33-
driverGlobal = neo4j.driver("bolt://localhost", neo4j.auth.basic("neo4j", "neo4j"));
34-
});
35-
25+
var driverGlobal = {close: function() {}};
3626
afterAll(function() {
37-
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
3827
driverGlobal.close();
3928
});
4029

4130
it('should work', function(done){
31+
var neo4jReq;
32+
// Assuming we only run this test on NodeJS
33+
if( !NodeChannel.available ) {
34+
done();
35+
return;
36+
}
37+
38+
try {
39+
neo4jReq = require(path.join(os.tmpdir(), 'sandbox', 'node_modules', 'neo4j-driver', 'lib'));
40+
} catch(e) {
41+
done.fail('Could not load sandbox package')
42+
}
43+
44+
driverGlobal = neo4jReq.v1.driver("bolt://localhost", neo4jReq.v1.auth.basic("neo4j", "neo4j"));
4245
var session = driverGlobal.session();
4346
session.run('RETURN 1 AS answer').then(function(result) {
4447
expect(result.records.length).toBe(1);

0 commit comments

Comments
 (0)