Skip to content

Commit 178eaf7

Browse files
committed
chore(ngx-material-password-strength): added tests tasks with jest-cli
1 parent 9ca125c commit 178eaf7

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

gulpfile.js

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const pump = require('pump');
2323

2424
/** Testing/Code Coverage */
2525
const gulpCoveralls = require('gulp-coveralls');
26+
const jestCli = require('jest-cli');
2627

2728
/** To order tasks */
2829
const runSequence = require('run-sequence');
@@ -571,20 +572,53 @@ gulp.task('deploy:demo', (cb) => {
571572
// Test Tasks
572573
/////////////////////////////////////////////////////////////////////////////
573574
gulp.task('test', (cb) => {
574-
const ENV = process.env.NODE_ENV = process.env.ENV = 'test';
575-
startKarmaServer(false, true, cb);
575+
let isTravis = !!process.env.TRAVIS;
576+
return jestCli.runCLI({
577+
config: require('./package.json').jest,
578+
coverage: true,
579+
runInBand: isTravis,
580+
ci: isTravis
581+
}, ".").then(({results}) => {
582+
if (!results.success) throw new Error('There are test failures!');
583+
});
576584
});
577585

578586
gulp.task('test:ci', ['clean'], (cb) => {
579587
runSequence('compile', 'test');
580588
});
581589

582590
gulp.task('test:watch', (cb) => {
591+
return jestCli.runCLI({config: require('./package.json').jest, watch: true}, ".").then(({results}) => {
592+
if (!results.success) throw new Error('There are test failures!');
593+
});
594+
});
595+
596+
gulp.task('test:watch-no-cc', (cb) => {//no coverage (useful for debugging failing tests in browser)
597+
return jestCli.runCLI({
598+
config: require('./package.json').jest,
599+
watch: true,
600+
coverage: false
601+
}, ".").then(({results}) => {
602+
if (!results.success) throw new Error('There are test failures!');
603+
});
604+
});
605+
606+
607+
gulp.task('test:karma', (cb) => {
608+
const ENV = process.env.NODE_ENV = process.env.ENV = 'test';
609+
startKarmaServer(false, true, cb);
610+
});
611+
612+
gulp.task('test:karma:ci', ['clean'], (cb) => {
613+
runSequence('compile', 'test');
614+
});
615+
616+
gulp.task('test:karma:watch', (cb) => {
583617
const ENV = process.env.NODE_ENV = process.env.ENV = 'test';
584618
startKarmaServer(true, true, cb);
585619
});
586620

587-
gulp.task('test:watch-no-cc', (cb) => {//no coverage (useful for debugging failing tests in browser)
621+
gulp.task('test:karma:watch-no-cc', (cb) => {//no coverage (useful for debugging failing tests in browser)
588622
const ENV = process.env.NODE_ENV = process.env.ENV = 'test';
589623
startKarmaServer(true, false, cb);
590624
});

0 commit comments

Comments
 (0)