Skip to content

Commit

Permalink
[FAB-12640] Enable disabled mocha tests
Browse files Browse the repository at this point in the history
- Remove the `.only` in the mocha tests
- Add enforced line coverage to prevent tests disappearing again

Change-Id: I825e1193791950d03eb78da98b9a74d1406e4f24
Signed-off-by: [email protected] <[email protected]>
  • Loading branch information
nklincoln committed Nov 6, 2018
1 parent 0713ad6 commit 4a6ef6a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
23 changes: 17 additions & 6 deletions build/tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

'use strict';

const addsrc = require('gulp-add-src');
const gulp = require('gulp');
const mocha = require('gulp-mocha');
const tape = require('gulp-tape');
Expand Down Expand Up @@ -185,13 +184,13 @@ gulp.task('run-test-cucumber', shell.task(
// 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', 'run-test-mocha', 'run-tape-unit', 'docker-clean', 'run-test-cucumber'];
const tasks = ['clean-up', 'docker-clean', 'pre-test', 'ca', 'compile', 'lint', 'run-test-mocha', 'run-tape-unit', 'docker-clean', 'run-test-cucumber', 'run-logger-unit'];
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'];
const tasks = ['clean-up', 'pre-test', 'ca', 'lint', 'run-test-mocha', 'run-tape-unit', 'run-logger-unit'];
runSequence(...tasks, done);
});

Expand All @@ -207,9 +206,21 @@ gulp.task('run-tape-unit',
'!test/unit/util.js',
'!test/unit/logger.js',
]))
.pipe(addsrc.append(
'test/unit/logger.js' // put this to the last so the debugging levels are not mixed up
))
.pipe(tape({
reporter: tapColorize()
}));
});

// Run logger in isolation
gulp.task('run-logger-unit',
() => {
// this is needed to avoid a problem in tape-promise with adding
// too many listeners to the "unhandledRejection" event
process.setMaxListeners(0);

return gulp.src(shouldRunPKCS11Tests([
'test/unit/logger.js'
]))
.pipe(tape({
reporter: tapColorize()
}));
Expand Down
2 changes: 1 addition & 1 deletion fabric-client/test/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -2852,7 +2852,7 @@ describe('Client', () => {
});
});

describe.only('readFile', () => {
describe('readFile', () => {
let readFileStub;
let readFile;
before(() => {
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@
"x509": "^0.3.2"
},
"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",
Expand Down

0 comments on commit 4a6ef6a

Please sign in to comment.