Skip to content

Commit

Permalink
FABN-599 Split code coverage checks for unit/fv
Browse files Browse the repository at this point in the history
- Add specific code coverage metrics for unit tests (mocha only)
- Add specific code coverage metrics for fv and scenario tests
- remove package level nyc settings

Change-Id: Idc99f08b99e8c5eebc37f6cbbdfe77ce1da13bb8
Signed-off-by: nkl199@yahoo.co.uk <nkl199@yahoo.co.uk>
  • Loading branch information
nklincoln committed Jan 29, 2019
1 parent ffef003 commit 8621a18
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 28 deletions.
16 changes: 12 additions & 4 deletions build/tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ gulp.task('compile', shell.task([
gulp.task('test', shell.task('npx nyc gulp run-test'));

// Test to run all unit tests
gulp.task('test-headless', shell.task('npx nyc gulp run-test-headless'));
gulp.task('test-headless', shell.task('npx gulp run-test-headless'));

// Only run Mocha unit tests
gulp.task('test-mocha', shell.task('npx nyc gulp run-test-mocha'));
gulp.task('test-mocha', shell.task('npx nyc --check-coverage --lines 92 --functions 90 --branches 70 gulp run-test-mocha'));

// Only run scenario tests
gulp.task('test-cucumber', shell.task('npx nyc npm run test:cucumber'));
Expand Down Expand Up @@ -180,16 +180,24 @@ gulp.task('run-test-cucumber', shell.task(
'export HFC_LOGGING=""; npm run test:cucumber'
));

// Run e2e and scenario tests with code coverage
gulp.task('test-fv-scenario', shell.task('npx nyc --check-coverage --lines 92 --functions 90 --branches 70 gulp run-test-fv-sceanrio'));

gulp.task('run-test-fv-sceanrio', (done) => {
const tasks = ['run-tape-e2e', 'run-logger-unit', 'docker-clean', 'run-test-cucumber'];
runSequence(...tasks, done);
});

// Main test method to run all test suites
// - lint, unit first, then FV, then scenario
gulp.task('run-test', (done) => {
const tasks = ['clean-up', 'docker-clean', 'pre-test', 'ca', 'compile', 'lint', 'docs', 'run-test-mocha', 'run-tape-unit', 'run-tape-e2e', 'run-logger-unit', 'docker-clean', 'run-test-cucumber'];
const tasks = ['clean-up', 'docker-clean', 'pre-test', 'ca', 'compile', 'lint', 'docs', 'test-mocha', 'run-tape-unit', 'test-fv-scenario'];
runSequence(...tasks, done);
});

// Run all non-integration tests
gulp.task('run-test-headless', (done) => {
const tasks = ['clean-up', 'pre-test', 'ca', 'lint', 'run-test-mocha', 'run-tape-unit', 'run-logger-unit'];
const tasks = ['clean-up', 'pre-test', 'ca', 'lint', 'test-mocha', 'run-tape-unit', 'run-logger-unit'];
runSequence(...tasks, done);
});

Expand Down
24 changes: 0 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,30 +81,6 @@
"winston": "^2.2.0",
"x509": "0.3.3"
},
"nyc": {
"check-coverage": true,
"statements": 85,
"branches": 80,
"functions": 91,
"lines": 85,
"include": [
"fabric-ca-client/lib/FabricCAClientImpl.js",
"fabric-ca-client/lib/helper.js",
"fabric-ca-client/lib/IdentityService.js",
"fabric-ca-client/lib/AffiliationService.js",
"fabric-client/lib/**/*.js",
"fabric-common/lib/**/*.js",
"fabric-network/lib/**/*.js"
],
"reporter": [
"lcov",
"json",
"text",
"text-summary",
"cobertura"
],
"cache": true
},
"license": "Apache-2.0",
"licenses": [
{
Expand Down

0 comments on commit 8621a18

Please sign in to comment.