Skip to content

Commit 3afdae3

Browse files
committed
test: increase JEST TIMEOUT for slow connections
1 parent 0d7fa05 commit 3afdae3

File tree

10 files changed

+27
-18
lines changed

10 files changed

+27
-18
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pids
1010

1111
# Directory for instrumented libs generated by jscoverage/JSCover
1212
lib-cov
13-
13+
tmp
1414

1515
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
1616
.grunt

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ import mongoose from 'mongoose';
299299
import MongoMemoryServer from 'mongodb-memory-server';
300300

301301
// May require additional time for downloading MongoDB binaries
302-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
302+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 600000;
303303

304304
let mongoServer;
305305
const opts = { useMongoClient: true }; // remove this option if you use mongoose 5 and above

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"babel-core": "^7.0.0-bridge.0",
4040
"babel-eslint": "^10.0.1",
4141
"babel-jest": "^23.6.0",
42+
"cross-env": "^5.2.0",
4243
"cz-conventional-changelog": "^2.1.0",
4344
"eslint": "^5.8.0",
4445
"eslint-config-airbnb-base": "^13.1.0",
@@ -78,8 +79,8 @@
7879
"build:cjs": "rimraf lib && babel src --ignore __tests__,__mocks__ -d lib",
7980
"build:flow": "find ./src -name '*.js' -not -path '*/__*' | while read filepath; do cp $filepath `echo $filepath | sed 's/\\/src\\//\\/lib\\//g'`.flow; done",
8081
"build:ts": "find ./src -name '*.d.ts' -not -path '*/__*' | while read filepath; do cp $filepath `echo $filepath | sed 's/\\/src\\//\\/lib\\//g'`; done",
81-
"watch": "jest --watch",
82-
"coverage": "jest --coverage",
82+
"watch": "cross-env MONGOMS_DOWNLOAD_DIR=./tmp jest --watch",
83+
"coverage": "cross-env MONGOMS_DOWNLOAD_DIR=./tmp jest --coverage",
8384
"lint": "eslint --ext .js ./src && npm run tslint",
8485
"flow": "./node_modules/.bin/flow",
8586
"test": "npm run coverage && npm run lint && npm run flow && npm run tscheck",

src/__tests__/multipleDB-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { MongoClient } from 'mongodb';
44
import MongoDBMemoryServer from '../MongoMemoryServer';
55

6-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
6+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 600000;
77

88
let con1;
99
let con2;
@@ -24,10 +24,10 @@ beforeAll(async () => {
2424
});
2525

2626
afterAll(() => {
27-
con1.close();
28-
con2.close();
29-
mongoServer1.stop();
30-
mongoServer2.stop();
27+
if (con1) con1.close();
28+
if (con2) con2.close();
29+
if (mongoServer1) mongoServer1.stop();
30+
if (mongoServer2) mongoServer2.stop();
3131
});
3232

3333
describe('Multiple mongoServers', () => {

src/__tests__/replset-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import MongoMemoryReplSet from '../MongoMemoryReplSet';
44

5-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
5+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 600000;
66

77
describe('single server replset', () => {
88
let replSet: MongoMemoryReplSet;

src/__tests__/singleDB-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { MongoClient } from 'mongodb';
44
import MongoDBMemoryServer from '../MongoMemoryServer';
55

6-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
6+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 600000;
77

88
let con;
99
let db;
@@ -16,8 +16,8 @@ beforeAll(async () => {
1616
});
1717

1818
afterAll(() => {
19-
con.close();
20-
mongoServer.stop();
19+
if (con) con.close();
20+
if (mongoServer) mongoServer.stop();
2121
});
2222

2323
describe('Single mongoServer', () => {

src/util/MongoBinaryDownload.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import fs from 'fs';
88
import md5File from 'md5-file';
99
import https from 'https';
1010
import HttpsProxyAgent from 'https-proxy-agent';
11-
import decompress from 'decompress';
11+
import decompress from 'decompress'; // 💩💩💩 this package does not work with Node@11+Jest+Babel
1212
import MongoBinaryDownloadUrl from './MongoBinaryDownloadUrl';
1313
import type { DebugFn, DebugPropT, DownloadProgressT } from '../types';
1414

src/util/__tests__/MongoBinary-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import tmp from 'tmp';
44
import MongoBinary from '../MongoBinary';
55

66
tmp.setGracefulCleanup();
7-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 160000;
7+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 600000;
88

99
describe('MongoBinary', () => {
1010
it('should download binary and keep it in cache', async () => {

src/util/__tests__/MongoInstance-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import tmp from 'tmp';
44
import MongoInstance from '../MongoInstance';
55

6-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 240000;
6+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 600000;
77

88
let tmpDir;
99
beforeEach(() => {

yarn.lock

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,6 +1907,14 @@ create-error-class@^3.0.0:
19071907
dependencies:
19081908
capture-stack-trace "^1.0.0"
19091909

1910+
cross-env@^5.2.0:
1911+
version "5.2.0"
1912+
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-5.2.0.tgz#6ecd4c015d5773e614039ee529076669b9d126f2"
1913+
integrity sha512-jtdNFfFW1hB7sMhr/H6rW1Z45LFqyI431m3qU6bFXcQ3Eh7LtBuG3h74o7ohHZ3crrRkkqHlo4jYHFPcjroANg==
1914+
dependencies:
1915+
cross-spawn "^6.0.5"
1916+
is-windows "^1.0.0"
1917+
19101918
cross-spawn@^5.0.1:
19111919
version "5.1.0"
19121920
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
@@ -2974,7 +2982,7 @@ get-value@^2.0.3, get-value@^2.0.6:
29742982
version "2.0.6"
29752983
resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28"
29762984

2977-
getos@^3.1.0:
2985+
getos@^3.1.1:
29782986
version "3.1.1"
29792987
resolved "https://registry.yarnpkg.com/getos/-/getos-3.1.1.tgz#967a813cceafee0156b0483f7cffa5b3eff029c5"
29802988
integrity sha512-oUP1rnEhAr97rkitiszGP9EgDVYnmchgFzfqRzSkgtfv7ai6tEi7Ko8GgjNXts7VLWEqrTWyhsOKLe5C5b/Zkg==
@@ -3664,7 +3672,7 @@ is-utf8@^0.2.0:
36643672
version "0.2.1"
36653673
resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72"
36663674

3667-
is-windows@^1.0.2:
3675+
is-windows@^1.0.0, is-windows@^1.0.2:
36683676
version "1.0.2"
36693677
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d"
36703678

0 commit comments

Comments
 (0)