@@ -7,115 +7,108 @@ import { ChangedFile } from './util/interfaces';
77describe ( 'bundle task' , ( ) => {
88
99 describe ( 'bundle' , ( ) => {
10- it ( 'should return the value rollup task returns' , ( done : Function ) => {
10+ it ( 'should return the value rollup task returns' , ( ) => {
1111 // arrange
1212 spyOn ( rollup , rollup . rollup . name ) . and . returnValue ( Promise . resolve ( ) ) ;
1313 const context = { bundler : Constants . BUNDLER_ROLLUP } ;
1414
1515 // act
16- bundle . bundle ( context ) . then ( ( ) => {
16+ return bundle . bundle ( context ) . then ( ( ) => {
1717 // assert
1818 expect ( rollup . rollup ) . toHaveBeenCalled ( ) ;
19- done ( ) ;
2019 } ) ;
2120 } ) ;
2221
23- it ( 'should throw when rollup throws' , ( done : Function ) => {
22+ it ( 'should throw when rollup throws' , ( ) => {
2423 const errorText = 'simulating an error' ;
2524 // arrange
2625 spyOn ( rollup , rollup . rollup . name ) . and . returnValue ( Promise . reject ( new Error ( errorText ) ) ) ;
2726 const context = { bundler : Constants . BUNDLER_ROLLUP } ;
2827
2928 // act
30- bundle . bundle ( context ) . then ( ( ) => {
29+ return bundle . bundle ( context ) . then ( ( ) => {
3130 throw new Error ( 'Should never happen' ) ;
3231 } ) . catch ( err => {
3332 // assert
3433 expect ( rollup . rollup ) . toHaveBeenCalled ( ) ;
3534 expect ( err . message ) . toBe ( errorText ) ;
36- done ( ) ;
3735 } ) ;
3836 } ) ;
3937
40- it ( 'should return the value webpack task returns' , ( done : Function ) => {
38+ it ( 'should return the value webpack task returns' , ( ) => {
4139 // arrange
4240 spyOn ( webpack , webpack . webpack . name ) . and . returnValue ( Promise . resolve ( ) ) ;
4341 const context = { bundler : Constants . BUNDLER_WEBPACK } ;
4442
4543 // act
46- bundle . bundle ( context ) . then ( ( ) => {
44+ return bundle . bundle ( context ) . then ( ( ) => {
4745 // assert
4846 expect ( webpack . webpack ) . toHaveBeenCalled ( ) ;
49- done ( ) ;
5047 } ) ;
5148 } ) ;
5249
53- it ( 'should throw when rollup throws' , ( done : Function ) => {
50+ it ( 'should throw when rollup throws' , ( ) => {
5451 const errorText = 'simulating an error' ;
5552 // arrange
5653 spyOn ( webpack , webpack . webpack . name ) . and . returnValue ( Promise . reject ( new Error ( errorText ) ) ) ;
5754 const context = { bundler : Constants . BUNDLER_WEBPACK } ;
5855
5956 // act
60- bundle . bundle ( context ) . then ( ( ) => {
57+ return bundle . bundle ( context ) . then ( ( ) => {
6158 throw new Error ( 'Should never happen' ) ;
6259 } ) . catch ( err => {
6360 // assert
6461 expect ( webpack . webpack ) . toHaveBeenCalled ( ) ;
6562 expect ( err . message ) . toBe ( errorText ) ;
66- done ( ) ;
6763 } ) ;
6864 } ) ;
6965 } ) ;
7066
7167 describe ( 'bundleUpdate' , ( ) => {
72- it ( 'should return the value rollup returns' , ( done : Function ) => {
68+ it ( 'should return the value rollup returns' , ( ) => {
7369 // arrange
7470 spyOn ( rollup , rollup . rollupUpdate . name ) . and . returnValue ( Promise . resolve ( ) ) ;
7571 const context = { bundler : Constants . BUNDLER_ROLLUP } ;
7672 const changedFiles : ChangedFile [ ] = [ ] ;
7773
7874 // act
79- bundle . bundleUpdate ( changedFiles , context ) . then ( ( ) => {
75+ return bundle . bundleUpdate ( changedFiles , context ) . then ( ( ) => {
8076 // assert
8177 expect ( rollup . rollupUpdate ) . toHaveBeenCalledWith ( changedFiles , context ) ;
82- done ( ) ;
8378 } ) ;
8479 } ) ;
8580
86- it ( 'should throw when rollup throws' , ( done : Function ) => {
81+ it ( 'should throw when rollup throws' , ( ) => {
8782 const errorText = 'simulating an error' ;
8883 // arrange
8984 spyOn ( rollup , rollup . rollupUpdate . name ) . and . returnValue ( Promise . reject ( new Error ( errorText ) ) ) ;
9085 const context = { bundler : Constants . BUNDLER_ROLLUP } ;
9186 const changedFiles : ChangedFile [ ] = [ ] ;
9287
9388 // act
94- bundle . bundleUpdate ( changedFiles , context ) . then ( ( ) => {
89+ return bundle . bundleUpdate ( changedFiles , context ) . then ( ( ) => {
9590 throw new Error ( 'Should never happen' ) ;
9691 } ) . catch ( err => {
9792 // assert
9893 expect ( rollup . rollupUpdate ) . toHaveBeenCalled ( ) ;
9994 expect ( err . message ) . toBe ( errorText ) ;
100- done ( ) ;
10195 } ) ;
10296 } ) ;
10397
104- it ( 'should return the value webpack returns' , ( done : Function ) => {
98+ it ( 'should return the value webpack returns' , ( ) => {
10599 // arrange
106100 spyOn ( webpack , webpack . webpackUpdate . name ) . and . returnValue ( Promise . resolve ( ) ) ;
107101 const context = { bundler : Constants . BUNDLER_WEBPACK } ;
108102 const changedFiles : ChangedFile [ ] = [ ] ;
109103
110104 // act
111- bundle . bundleUpdate ( changedFiles , context ) . then ( ( ) => {
105+ return bundle . bundleUpdate ( changedFiles , context ) . then ( ( ) => {
112106 // assert
113107 expect ( webpack . webpackUpdate ) . toHaveBeenCalledWith ( changedFiles , context ) ;
114- done ( ) ;
115108 } ) ;
116109 } ) ;
117110
118- it ( 'should throw when webpack throws' , ( done : Function ) => {
111+ it ( 'should throw when webpack throws' , ( ) => {
119112 const errorText = 'simulating an error' ;
120113 try {
121114 // arrange
@@ -124,13 +117,12 @@ describe('bundle task', () => {
124117 const changedFiles : ChangedFile [ ] = [ ] ;
125118
126119 // act
127- bundle . bundleUpdate ( changedFiles , context ) . then ( ( ) => {
120+ return bundle . bundleUpdate ( changedFiles , context ) . then ( ( ) => {
128121 throw new Error ( 'Should never happen' ) ;
129122 } ) . catch ( err => {
130123 // assert
131124 expect ( webpack . webpackUpdate ) . toHaveBeenCalled ( ) ;
132125 expect ( err . message ) . toBe ( errorText ) ;
133- done ( ) ;
134126 } ) ;
135127
136128 } catch ( ex ) {
0 commit comments