Skip to content

Commit 3ac6583

Browse files
committed
Disable tests that don't work in Postgres, and don't start a mongo for postgres tests
1 parent 39078e8 commit 3ac6583

7 files changed

+32
-24
lines changed

package.json

+7-9
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"redis": "2.6.2",
4343
"request": "2.74.0",
4444
"request-promise": "4.1.0",
45-
"semver": "^5.2.0",
45+
"semver": "5.2.0",
4646
"tv4": "1.2.7",
4747
"winston": "2.2.0",
4848
"winston-daily-rotate-file": "1.2.0",
@@ -67,14 +67,12 @@
6767
},
6868
"scripts": {
6969
"dev": "npm run build && node bin/dev",
70-
"build": "babel src/ -d lib/",
71-
"pretest": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.2.6} MONGODB_STORAGE_ENGINE=mmapv1 mongodb-runner start",
72-
"test": "cross-env NODE_ENV=test TESTING=1 babel-node $COVERAGE_OPTION ./node_modules/jasmine/bin/jasmine.js",
73-
"test:win": "npm run pretest && cross-env NODE_ENV=test TESTING=1 babel-node ./node_modules/jasmine/bin/jasmine.js && npm run posttest",
74-
"posttest": "mongodb-runner stop",
75-
"coverage": "cross-env COVERAGE_OPTION='./node_modules/.bin/istanbul cover' npm test",
76-
"coverage:win": "npm run pretest && cross-env NODE_ENV=test TESTING=1 babel-node ./node_modules/babel-istanbul/lib/cli.js cover ./node_modules/jasmine/bin/jasmine.js && npm run posttest",
77-
"start": "node ./bin/parse-server",
70+
"build": "./node_modules/.bin/babel src/ -d lib/",
71+
"pretest": "test -z \"$PARSE_SERVER_TEST_DB\" && cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.2.6} MONGODB_STORAGE_ENGINE=mmapv1 ./node_modules/.bin/mongodb-runner start || echo",
72+
"test": "cross-env NODE_ENV=test TESTING=1 ./node_modules/.bin/babel-node $COVERAGE_OPTION ./node_modules/jasmine/bin/jasmine.js",
73+
"test:win": "npm run pretest && cross-env NODE_ENV=test TESTING=1 ./node_modules/.bin/babel-node ./node_modules/babel-istanbul/lib/cli.js cover -x **/spec/** ./node_modules/jasmine/bin/jasmine.js && npm run posttest",
74+
"posttest": "./node_modules/.bin/mongodb-runner stop",
75+
"coverage": "cross-env COVERAGE_OPTION='./node_modules/babel-istanbul/lib/cli.js cover -x **/spec/**' npm test",
7876
"prepublish": "npm run build"
7977
},
8078
"engines": {

spec/MongoStorageAdapter.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const databaseURI = 'mongodb://localhost:27017/parseServerMongoAdapterTestDataba
66

77
// These tests are specific to the mongo storage adapter + mongo storage format
88
// and will eventually be moved into their own repo
9-
describe('MongoStorageAdapter', () => {
9+
describe_only_db('mongo')('MongoStorageAdapter', () => {
1010
beforeEach(done => {
1111
new MongoStorageAdapter({ uri: databaseURI })
1212
.deleteAllClasses()

spec/ParseACL.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ describe('Parse.ACL', () => {
10931093
});
10941094
});
10951095

1096-
it("acl saveAll with permissions", (done) => {
1096+
it_exclude_dbs(['postgres'])("acl saveAll with permissions", (done) => {
10971097
Parse.User.signUp("alice", "wonderland", null, {
10981098
success: function(alice) {
10991099
var acl = new Parse.ACL(alice);

spec/ParseAPI.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ describe('miscellaneous', function() {
348348
});
349349
});
350350

351-
it('test rest_create_app', function(done) {
351+
it_exclude_dbs(['postgres'])('test rest_create_app', function(done) {
352352
var appId;
353353
Parse._request('POST', 'rest_create_app').then((res) => {
354354
expect(typeof res.application_id).toEqual('string');

spec/ParseFile.spec.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ for (var i = 0; i < str.length; i++) {
1313

1414
describe('Parse.File testing', () => {
1515
describe('creating files', () => {
16-
it('works with Content-Type', done => {
16+
it_exclude_dbs(['postgres'])('works with Content-Type', done => {
1717
var headers = {
1818
'Content-Type': 'application/octet-stream',
1919
'X-Parse-Application-Id': 'test',
@@ -37,7 +37,7 @@ describe('Parse.File testing', () => {
3737
});
3838

3939

40-
it('works with _ContentType', done => {
40+
it_exclude_dbs(['postgres'])('works with _ContentType', done => {
4141

4242
request.post({
4343
url: 'http://localhost:8378/1/files/file',
@@ -61,7 +61,7 @@ describe('Parse.File testing', () => {
6161
});
6262
});
6363

64-
it('works without Content-Type', done => {
64+
it_exclude_dbs(['postgres'])('works without Content-Type', done => {
6565
var headers = {
6666
'X-Parse-Application-Id': 'test',
6767
'X-Parse-REST-API-Key': 'rest'
@@ -84,7 +84,7 @@ describe('Parse.File testing', () => {
8484
});
8585
});
8686

87-
it('supports REST end-to-end file create, read, delete, read', done => {
87+
it_exclude_dbs(['postgres'])('supports REST end-to-end file create, read, delete, read', done => {
8888
var headers = {
8989
'Content-Type': 'image/jpeg',
9090
'X-Parse-Application-Id': 'test',
@@ -128,7 +128,7 @@ describe('Parse.File testing', () => {
128128
});
129129
});
130130

131-
it('blocks file deletions with missing or incorrect master-key header', done => {
131+
it_exclude_dbs(['postgres'])('blocks file deletions with missing or incorrect master-key header', done => {
132132
var headers = {
133133
'Content-Type': 'image/jpeg',
134134
'X-Parse-Application-Id': 'test',
@@ -173,7 +173,7 @@ describe('Parse.File testing', () => {
173173
});
174174
});
175175

176-
it('handles other filetypes', done => {
176+
it_exclude_dbs(['postgres'])('handles other filetypes', done => {
177177
var headers = {
178178
'Content-Type': 'image/jpeg',
179179
'X-Parse-Application-Id': 'test',
@@ -196,7 +196,7 @@ describe('Parse.File testing', () => {
196196
});
197197
});
198198

199-
it("save file", done => {
199+
it_exclude_dbs(['postgres'])("save file", done => {
200200
var file = new Parse.File("hello.txt", data, "text/plain");
201201
ok(!file.url());
202202
file.save(expectSuccess({
@@ -316,7 +316,7 @@ describe('Parse.File testing', () => {
316316
}));
317317
});
318318

319-
it("saving an already saved file", done => {
319+
it_exclude_dbs(['postgres'])("saving an already saved file", done => {
320320
var file = new Parse.File("hello.txt", data, "text/plain");
321321
ok(!file.url());
322322
file.save(expectSuccess({
@@ -337,7 +337,7 @@ describe('Parse.File testing', () => {
337337
}));
338338
});
339339

340-
it("two saves at the same time", done => {
340+
it_exclude_dbs(['postgres'])("two saves at the same time", done => {
341341
var file = new Parse.File("hello.txt", data, "text/plain");
342342

343343
var firstName;
@@ -369,7 +369,7 @@ describe('Parse.File testing', () => {
369369
}));
370370
});
371371

372-
it("content-type used with no extension", done => {
372+
it_exclude_dbs(['postgres'])("content-type used with no extension", done => {
373373
var headers = {
374374
'Content-Type': 'text/html',
375375
'X-Parse-Application-Id': 'test',
@@ -390,7 +390,7 @@ describe('Parse.File testing', () => {
390390
});
391391
});
392392

393-
it("filename is url encoded", done => {
393+
it_exclude_dbs(['postgres'])("filename is url encoded", done => {
394394
var headers = {
395395
'Content-Type': 'text/html',
396396
'X-Parse-Application-Id': 'test',

spec/ParseUser.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1698,7 +1698,7 @@ describe('Parse.User testing', () => {
16981698
bob.setPassword('meower');
16991699
return bob.save();
17001700
}).then(() => {
1701-
return Parse.User.logIn('bob', 'meower');
1701+
return Parse.User.logIn('bob', 'meower');
17021702
}).then((bob) => {
17031703
expect(bob.getUsername()).toEqual('bob');
17041704
done();

spec/helper.js

+10
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,16 @@ global.fit_exclude_dbs = excluded => {
342342
}
343343
}
344344

345+
global.describe_only_db = db => {
346+
if (process.env.PARSE_SERVER_TEST_DB == db) {
347+
return describe;
348+
} else if (!process.env.PARSE_SERVER_TEST_DB && db == 'mongo') {
349+
return describe;
350+
} else {
351+
return () => {};
352+
}
353+
}
354+
345355
// LiveQuery test setting
346356
require('../src/LiveQuery/PLog').logLevel = 'NONE';
347357
var libraryCache = {};

0 commit comments

Comments
 (0)