Skip to content

Commit

Permalink
use nyc for coverage (#3652)
Browse files Browse the repository at this point in the history
* use nyc for coverage

* removes unnecessary logss

* Disable RedisCacheAdapter tests when not in specific environment
  • Loading branch information
flovilmart authored and Arthur Cinader committed Mar 20, 2017
1 parent eeb3a70 commit f3765e0
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 15 deletions.
5 changes: 3 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
lib/*
coverage/*
lib
coverage

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ lib-cov

# Coverage directory used by tools like istanbul
coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
Expand Down
2 changes: 0 additions & 2 deletions .istanbul.yml

This file was deleted.

11 changes: 11 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"reporter": [
"lcov",
"text-summary"
],
"exclude": [
"**/spec/**",
"lib/"
]
}

2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ before_script:
- psql -c 'CREATE EXTENSION postgis_topology;' -U postgres -d parse_server_postgres_adapter_test_database
env:
global:
- COVERAGE_OPTION='./node_modules/.bin/istanbul cover'
- COVERAGE_OPTION='./node_modules/.bin/nyc'
matrix:
- MONGODB_VERSION=3.0.8
- MONGODB_VERSION=3.2.6
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"ws": "2.2.1"
},
"devDependencies": {

"babel-cli": "6.24.0",
"babel-core": "6.23.1",
"babel-eslint": "^7.1.1",
Expand All @@ -59,11 +58,11 @@
"eslint": "^3.16.1",
"eslint-plugin-flowtype": "^2.25.0",
"gaze": "1.1.1",
"istanbul": "1.0.0-alpha.1",
"jasmine": "2.5.3",
"jasmine-spec-reporter": "^3.1.0",
"mongodb-runner": "3.4.0",
"nodemon": "1.11.0",
"nyc": "^10.1.2",
"request-promise": "4.2.0"
},
"scripts": {
Expand All @@ -73,8 +72,8 @@
"pretest": "npm run lint",
"test": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.2.6} MONGODB_STORAGE_ENGINE=mmapv1 NODE_ENV=test TESTING=1 $COVERAGE_OPTION jasmine",
"test:win": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.2.6} MONGODB_STORAGE_ENGINE=mmapv1 NODE_ENV=test TESTING=1 jasmine",
"coverage": "cross-env COVERAGE_OPTION='./node_modules/.bin/istanbul cover' npm test",
"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",
"coverage": "cross-env COVERAGE_OPTION='./node_modules/.bin/nyc' npm test",
"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",
"start": "node ./bin/parse-server",
"prepublish": "npm run build"
},
Expand Down
1 change: 1 addition & 0 deletions spec/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"notEqual": true,
"it_exclude_dbs": true,
"describe_only_db": true,
"describe_only": true,
"on_db": true,
"defaultConfiguration": true,
"expectSuccess": true,
Expand Down
6 changes: 2 additions & 4 deletions spec/ParseACL.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -755,14 +755,12 @@ describe('Parse.ACL', () => {
user2.set("password", "burger");
return user2.signUp();
}).then(() => {
console.log(user2.getSessionToken());
return object.destroy({sessionToken: user2.getSessionToken() });
}).then((res) => {
console.log(res);
}).then(() => {
fail('should not be able to destroy the object');
done();
}, (err) => {
console.error(err);
expect(err).not.toBeUndefined();
done();
});
});
Expand Down
10 changes: 8 additions & 2 deletions spec/RedisCacheAdapter.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
var RedisCacheAdapter = require('../src/Adapters/Cache/RedisCacheAdapter').default;

describe('RedisCacheAdapter', function() {
/*
To run this test part of the complete suite
set PARSE_SERVER_TEST_CACHE='redis'
and make sure a redis server is available on the default port
*/
describe_only(() => {
return process.env.PARSE_SERVER_TEST_CACHE === 'redis';
})('RedisCacheAdapter', function() {
var KEY = 'hello';
var VALUE = 'world';

Expand Down
8 changes: 8 additions & 0 deletions spec/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,14 @@ global.describe_only_db = db => {
}
}

global.describe_only = (validator) =>{
if (validator()) {
return describe;
} else {
return xdescribe;
}
};


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

0 comments on commit f3765e0

Please sign in to comment.