@@ -7,115 +7,108 @@ import { ChangedFile } from './util/interfaces';
7
7
describe ( 'bundle task' , ( ) => {
8
8
9
9
describe ( 'bundle' , ( ) => {
10
- it ( 'should return the value rollup task returns' , ( done : Function ) => {
10
+ it ( 'should return the value rollup task returns' , ( ) => {
11
11
// arrange
12
12
spyOn ( rollup , rollup . rollup . name ) . and . returnValue ( Promise . resolve ( ) ) ;
13
13
const context = { bundler : Constants . BUNDLER_ROLLUP } ;
14
14
15
15
// act
16
- bundle . bundle ( context ) . then ( ( ) => {
16
+ return bundle . bundle ( context ) . then ( ( ) => {
17
17
// assert
18
18
expect ( rollup . rollup ) . toHaveBeenCalled ( ) ;
19
- done ( ) ;
20
19
} ) ;
21
20
} ) ;
22
21
23
- it ( 'should throw when rollup throws' , ( done : Function ) => {
22
+ it ( 'should throw when rollup throws' , ( ) => {
24
23
const errorText = 'simulating an error' ;
25
24
// arrange
26
25
spyOn ( rollup , rollup . rollup . name ) . and . returnValue ( Promise . reject ( new Error ( errorText ) ) ) ;
27
26
const context = { bundler : Constants . BUNDLER_ROLLUP } ;
28
27
29
28
// act
30
- bundle . bundle ( context ) . then ( ( ) => {
29
+ return bundle . bundle ( context ) . then ( ( ) => {
31
30
throw new Error ( 'Should never happen' ) ;
32
31
} ) . catch ( err => {
33
32
// assert
34
33
expect ( rollup . rollup ) . toHaveBeenCalled ( ) ;
35
34
expect ( err . message ) . toBe ( errorText ) ;
36
- done ( ) ;
37
35
} ) ;
38
36
} ) ;
39
37
40
- it ( 'should return the value webpack task returns' , ( done : Function ) => {
38
+ it ( 'should return the value webpack task returns' , ( ) => {
41
39
// arrange
42
40
spyOn ( webpack , webpack . webpack . name ) . and . returnValue ( Promise . resolve ( ) ) ;
43
41
const context = { bundler : Constants . BUNDLER_WEBPACK } ;
44
42
45
43
// act
46
- bundle . bundle ( context ) . then ( ( ) => {
44
+ return bundle . bundle ( context ) . then ( ( ) => {
47
45
// assert
48
46
expect ( webpack . webpack ) . toHaveBeenCalled ( ) ;
49
- done ( ) ;
50
47
} ) ;
51
48
} ) ;
52
49
53
- it ( 'should throw when rollup throws' , ( done : Function ) => {
50
+ it ( 'should throw when rollup throws' , ( ) => {
54
51
const errorText = 'simulating an error' ;
55
52
// arrange
56
53
spyOn ( webpack , webpack . webpack . name ) . and . returnValue ( Promise . reject ( new Error ( errorText ) ) ) ;
57
54
const context = { bundler : Constants . BUNDLER_WEBPACK } ;
58
55
59
56
// act
60
- bundle . bundle ( context ) . then ( ( ) => {
57
+ return bundle . bundle ( context ) . then ( ( ) => {
61
58
throw new Error ( 'Should never happen' ) ;
62
59
} ) . catch ( err => {
63
60
// assert
64
61
expect ( webpack . webpack ) . toHaveBeenCalled ( ) ;
65
62
expect ( err . message ) . toBe ( errorText ) ;
66
- done ( ) ;
67
63
} ) ;
68
64
} ) ;
69
65
} ) ;
70
66
71
67
describe ( 'bundleUpdate' , ( ) => {
72
- it ( 'should return the value rollup returns' , ( done : Function ) => {
68
+ it ( 'should return the value rollup returns' , ( ) => {
73
69
// arrange
74
70
spyOn ( rollup , rollup . rollupUpdate . name ) . and . returnValue ( Promise . resolve ( ) ) ;
75
71
const context = { bundler : Constants . BUNDLER_ROLLUP } ;
76
72
const changedFiles : ChangedFile [ ] = [ ] ;
77
73
78
74
// act
79
- bundle . bundleUpdate ( changedFiles , context ) . then ( ( ) => {
75
+ return bundle . bundleUpdate ( changedFiles , context ) . then ( ( ) => {
80
76
// assert
81
77
expect ( rollup . rollupUpdate ) . toHaveBeenCalledWith ( changedFiles , context ) ;
82
- done ( ) ;
83
78
} ) ;
84
79
} ) ;
85
80
86
- it ( 'should throw when rollup throws' , ( done : Function ) => {
81
+ it ( 'should throw when rollup throws' , ( ) => {
87
82
const errorText = 'simulating an error' ;
88
83
// arrange
89
84
spyOn ( rollup , rollup . rollupUpdate . name ) . and . returnValue ( Promise . reject ( new Error ( errorText ) ) ) ;
90
85
const context = { bundler : Constants . BUNDLER_ROLLUP } ;
91
86
const changedFiles : ChangedFile [ ] = [ ] ;
92
87
93
88
// act
94
- bundle . bundleUpdate ( changedFiles , context ) . then ( ( ) => {
89
+ return bundle . bundleUpdate ( changedFiles , context ) . then ( ( ) => {
95
90
throw new Error ( 'Should never happen' ) ;
96
91
} ) . catch ( err => {
97
92
// assert
98
93
expect ( rollup . rollupUpdate ) . toHaveBeenCalled ( ) ;
99
94
expect ( err . message ) . toBe ( errorText ) ;
100
- done ( ) ;
101
95
} ) ;
102
96
} ) ;
103
97
104
- it ( 'should return the value webpack returns' , ( done : Function ) => {
98
+ it ( 'should return the value webpack returns' , ( ) => {
105
99
// arrange
106
100
spyOn ( webpack , webpack . webpackUpdate . name ) . and . returnValue ( Promise . resolve ( ) ) ;
107
101
const context = { bundler : Constants . BUNDLER_WEBPACK } ;
108
102
const changedFiles : ChangedFile [ ] = [ ] ;
109
103
110
104
// act
111
- bundle . bundleUpdate ( changedFiles , context ) . then ( ( ) => {
105
+ return bundle . bundleUpdate ( changedFiles , context ) . then ( ( ) => {
112
106
// assert
113
107
expect ( webpack . webpackUpdate ) . toHaveBeenCalledWith ( changedFiles , context ) ;
114
- done ( ) ;
115
108
} ) ;
116
109
} ) ;
117
110
118
- it ( 'should throw when webpack throws' , ( done : Function ) => {
111
+ it ( 'should throw when webpack throws' , ( ) => {
119
112
const errorText = 'simulating an error' ;
120
113
try {
121
114
// arrange
@@ -124,13 +117,12 @@ describe('bundle task', () => {
124
117
const changedFiles : ChangedFile [ ] = [ ] ;
125
118
126
119
// act
127
- bundle . bundleUpdate ( changedFiles , context ) . then ( ( ) => {
120
+ return bundle . bundleUpdate ( changedFiles , context ) . then ( ( ) => {
128
121
throw new Error ( 'Should never happen' ) ;
129
122
} ) . catch ( err => {
130
123
// assert
131
124
expect ( webpack . webpackUpdate ) . toHaveBeenCalled ( ) ;
132
125
expect ( err . message ) . toBe ( errorText ) ;
133
- done ( ) ;
134
126
} ) ;
135
127
136
128
} catch ( ex ) {
0 commit comments