Skip to content

Commit f3765e0

Browse files
flovilmartArthur Cinader
authored andcommitted
use nyc for coverage (#3652)
* use nyc for coverage * removes unnecessary logss * Disable RedisCacheAdapter tests when not in specific environment
1 parent eeb3a70 commit f3765e0

File tree

10 files changed

+38
-15
lines changed

10 files changed

+38
-15
lines changed

.eslintignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
lib/*
2-
coverage/*
1+
lib
2+
coverage
3+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ lib-cov
1313

1414
# Coverage directory used by tools like istanbul
1515
coverage
16+
.nyc_output
1617

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

.istanbul.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

.nycrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"reporter": [
3+
"lcov",
4+
"text-summary"
5+
],
6+
"exclude": [
7+
"**/spec/**",
8+
"lib/"
9+
]
10+
}
11+

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ before_script:
1818
- psql -c 'CREATE EXTENSION postgis_topology;' -U postgres -d parse_server_postgres_adapter_test_database
1919
env:
2020
global:
21-
- COVERAGE_OPTION='./node_modules/.bin/istanbul cover'
21+
- COVERAGE_OPTION='./node_modules/.bin/nyc'
2222
matrix:
2323
- MONGODB_VERSION=3.0.8
2424
- MONGODB_VERSION=3.2.6

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
"ws": "2.2.1"
4545
},
4646
"devDependencies": {
47-
4847
"babel-cli": "6.24.0",
4948
"babel-core": "6.23.1",
5049
"babel-eslint": "^7.1.1",
@@ -59,11 +58,11 @@
5958
"eslint": "^3.16.1",
6059
"eslint-plugin-flowtype": "^2.25.0",
6160
"gaze": "1.1.1",
62-
"istanbul": "1.0.0-alpha.1",
6361
"jasmine": "2.5.3",
6462
"jasmine-spec-reporter": "^3.1.0",
6563
"mongodb-runner": "3.4.0",
6664
"nodemon": "1.11.0",
65+
"nyc": "^10.1.2",
6766
"request-promise": "4.2.0"
6867
},
6968
"scripts": {
@@ -73,8 +72,8 @@
7372
"pretest": "npm run lint",
7473
"test": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.2.6} MONGODB_STORAGE_ENGINE=mmapv1 NODE_ENV=test TESTING=1 $COVERAGE_OPTION jasmine",
7574
"test:win": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.2.6} MONGODB_STORAGE_ENGINE=mmapv1 NODE_ENV=test TESTING=1 jasmine",
76-
"coverage": "cross-env COVERAGE_OPTION='./node_modules/.bin/istanbul cover' npm test",
77-
"coverage:win": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.2.6} MONGODB_STORAGE_ENGINE=mmapv1 NODE_ENV=test TESTING=1 node ./node_modules/istanbul/lib/cli.js cover ./node_modules/jasmine/bin/jasmine.js",
75+
"coverage": "cross-env COVERAGE_OPTION='./node_modules/.bin/nyc' npm test",
76+
"coverage:win": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.2.6} MONGODB_STORAGE_ENGINE=mmapv1 NODE_ENV=test TESTING=1 node ./node_modules/.bin/nyc ./node_modules/jasmine/bin/jasmine.js",
7877
"start": "node ./bin/parse-server",
7978
"prepublish": "npm run build"
8079
},

spec/.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"notEqual": true,
1717
"it_exclude_dbs": true,
1818
"describe_only_db": true,
19+
"describe_only": true,
1920
"on_db": true,
2021
"defaultConfiguration": true,
2122
"expectSuccess": true,

spec/ParseACL.spec.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -755,14 +755,12 @@ describe('Parse.ACL', () => {
755755
user2.set("password", "burger");
756756
return user2.signUp();
757757
}).then(() => {
758-
console.log(user2.getSessionToken());
759758
return object.destroy({sessionToken: user2.getSessionToken() });
760-
}).then((res) => {
761-
console.log(res);
759+
}).then(() => {
762760
fail('should not be able to destroy the object');
763761
done();
764762
}, (err) => {
765-
console.error(err);
763+
expect(err).not.toBeUndefined();
766764
done();
767765
});
768766
});

spec/RedisCacheAdapter.spec.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
var RedisCacheAdapter = require('../src/Adapters/Cache/RedisCacheAdapter').default;
2-
3-
describe('RedisCacheAdapter', function() {
2+
/*
3+
To run this test part of the complete suite
4+
set PARSE_SERVER_TEST_CACHE='redis'
5+
and make sure a redis server is available on the default port
6+
*/
7+
describe_only(() => {
8+
return process.env.PARSE_SERVER_TEST_CACHE === 'redis';
9+
})('RedisCacheAdapter', function() {
410
var KEY = 'hello';
511
var VALUE = 'world';
612

spec/helper.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,14 @@ global.describe_only_db = db => {
419419
}
420420
}
421421

422+
global.describe_only = (validator) =>{
423+
if (validator()) {
424+
return describe;
425+
} else {
426+
return xdescribe;
427+
}
428+
};
429+
422430

423431
var libraryCache = {};
424432
jasmine.mockLibrary = function(library, name, mock) {

0 commit comments

Comments
 (0)