'use strict';

var gulp = require('gulp');
var tape = require('gulp-tape');
var tapColorize = require('tap-colorize');
var istanbul = require('gulp-istanbul');

gulp.task('pre-test', function() {
	return gulp.src(['node_modules/hfc/lib/**/*.js','node_modules/hfc-cop/lib/**/*.js'])
		.pipe(istanbul())
		.pipe(istanbul.hookRequire());
});

gulp.task('test', ['pre-test'], function() {
	// use individual tests to control the sequence they get executed
	// first run the ca-tests that tests all the member registration and
	// enrollment scenarios (good and bad calls). then the rest of the
	// tests will re-used the same key value store that has saved the
	// user certificates so they can interact with the network
	return gulp.src([
		// 'test/unit/ca-tests.js',
		'test/unit/chain-fabriccop-tests.js',
		'test/unit/endorser-tests.js',
		'test/unit/orderer-tests.js',
		'test/unit/orderer-chain-tests.js',
		//'test/unit/end-to-end.js',
		'test/unit/headless-tests.js'
	])
	.pipe(tape({
		reporter: tapColorize()
	}))
	.pipe(istanbul.writeReports());
});

gulp.task('test-headless', ['pre-test'], function() {
	return gulp.src('test/unit/headless-tests.js')
		.pipe(tape({
			reporter: tapColorize()
		}))
		.pipe(istanbul.writeReports());
});

@@ -207,16 +207,19 @@
 lp.src(%5B
+%0A%09%09
 'node_mo
@@ -241,16 +241,19 @@
 */*.js',
+%0A%09%09
 'node_mo
@@ -274,20 +274,28 @@
 lib/
-**/*
+FabricCOPImpl
 .js'%5D)%0A
-%09
 %09.pi
@@ -309,17 +309,16 @@
 nbul())%0A
-%09
 %09.pipe(i

Remove double-counted files in istanbul config