@@ -23,6 +23,7 @@ const pump = require('pump');
23
23
24
24
/** Testing/Code Coverage */
25
25
const gulpCoveralls = require ( 'gulp-coveralls' ) ;
26
+ const jestCli = require ( 'jest-cli' ) ;
26
27
27
28
/** To order tasks */
28
29
const runSequence = require ( 'run-sequence' ) ;
@@ -571,20 +572,53 @@ gulp.task('deploy:demo', (cb) => {
571
572
// Test Tasks
572
573
/////////////////////////////////////////////////////////////////////////////
573
574
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
+ } ) ;
576
584
} ) ;
577
585
578
586
gulp . task ( 'test:ci' , [ 'clean' ] , ( cb ) => {
579
587
runSequence ( 'compile' , 'test' ) ;
580
588
} ) ;
581
589
582
590
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 ) => {
583
617
const ENV = process . env . NODE_ENV = process . env . ENV = 'test' ;
584
618
startKarmaServer ( true , true , cb ) ;
585
619
} ) ;
586
620
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)
588
622
const ENV = process . env . NODE_ENV = process . env . ENV = 'test' ;
589
623
startKarmaServer ( true , false , cb ) ;
590
624
} ) ;
0 commit comments