@@ -65,6 +65,8 @@ describe('Basic end-to-end Workflow', function () {
65
65
'--silent'
66
66
] ) . then ( function ( ) {
67
67
expect ( fs . existsSync ( path . join ( process . cwd ( ) , 'dist' ) ) ) . to . be . equal ( true ) ;
68
+ } ) . catch ( ( err ) => {
69
+ throw new Error ( 'Build failed.' ) ;
68
70
} ) ;
69
71
} ) ;
70
72
@@ -87,7 +89,8 @@ describe('Basic end-to-end Workflow', function () {
87
89
88
90
return ng ( testArgs )
89
91
. then ( function ( result ) {
90
- expect ( result . exitCode ) . to . be . equal ( 0 ) ;
92
+ const exitCode = typeof result === 'object' ? result . exitCode : result ;
93
+ expect ( exitCode ) . to . be . equal ( 0 ) ;
91
94
} ) ;
92
95
} ) ;
93
96
@@ -111,7 +114,8 @@ describe('Basic end-to-end Workflow', function () {
111
114
112
115
return ng ( testArgs )
113
116
. then ( function ( result ) {
114
- expect ( result . exitCode ) . to . be . equal ( 0 ) ;
117
+ const exitCode = typeof result === 'object' ? result . exitCode : result ;
118
+ expect ( exitCode ) . to . be . equal ( 0 ) ;
115
119
} ) ;
116
120
} ) ;
117
121
@@ -133,7 +137,8 @@ describe('Basic end-to-end Workflow', function () {
133
137
134
138
return ng ( testArgs )
135
139
. then ( function ( result ) {
136
- expect ( result . exitCode ) . to . be . equal ( 0 ) ;
140
+ const exitCode = typeof result === 'object' ? result . exitCode : result ;
141
+ expect ( exitCode ) . to . be . equal ( 0 ) ;
137
142
} ) ;
138
143
} ) ;
139
144
@@ -155,7 +160,8 @@ describe('Basic end-to-end Workflow', function () {
155
160
156
161
return ng ( testArgs )
157
162
. then ( function ( result ) {
158
- expect ( result . exitCode ) . to . be . equal ( 0 ) ;
163
+ const exitCode = typeof result === 'object' ? result . exitCode : result ;
164
+ expect ( exitCode ) . to . be . equal ( 0 ) ;
159
165
} ) ;
160
166
} ) ;
161
167
@@ -186,41 +192,36 @@ describe('Basic end-to-end Workflow', function () {
186
192
187
193
return ng ( testArgs )
188
194
. then ( function ( result ) {
189
- expect ( result . exitCode ) . to . be . equal ( 0 ) ;
190
-
191
- // Clean `tmp` folder
192
- // process.chdir(path.resolve(root, '..'));
193
- // sh.rm('-rf', './tmp'); // tmp.teardown takes too long
195
+ const exitCode = typeof result === 'object' ? result . exitCode : result ;
196
+ expect ( exitCode ) . to . be . equal ( 0 ) ;
194
197
} ) ;
195
198
} ) ;
196
199
197
200
it ( 'Turn on `noImplicitAny` in tsconfig.json and rebuild' , function ( done ) {
198
201
this . timeout ( 420000 ) ;
199
202
200
- var configFilePath = path . join ( process . cwd ( ) , 'src' , 'tsconfig.json' ) ;
201
- fs . readFile ( configFilePath , 'utf8' , function ( err , data ) {
202
-
203
- var config = JSON . parse ( data ) ;
204
- config . compilerOptions . noImplicitAny = true ;
205
-
206
- fs . writeFile ( configFilePath , JSON . stringify ( config ) , function ( ) {
207
- //clear the dist folder
208
- sh . rm ( '-rf' , path . join ( process . cwd ( ) , 'dist' ) ) ;
209
-
210
- return ng ( [
211
- 'build' ,
212
- '--silent'
213
- ] ) . then ( function ( ) {
214
- expect ( fs . existsSync ( path . join ( process . cwd ( ) , 'dist' ) ) ) . to . be . equal ( true ) ;
215
- } )
216
- . finally ( function ( ) {
217
- // Clean `tmp` folder
218
- process . chdir ( path . resolve ( root , '..' ) ) ;
219
- sh . rm ( '-rf' , './tmp' ) ; // tmp.teardown takes too long
220
- done ( ) ;
221
- } ) ;
222
- } ) ;
223
- } ) ;
203
+ const configFilePath = path . join ( process . cwd ( ) , 'src' , 'tsconfig.json' ) ;
204
+ let config = require ( configFilePath ) ;
205
+
206
+ config . compilerOptions . noImplicitAny = true ;
207
+ fs . writeFileSync ( configFilePath , JSON . stringify ( config ) , 'utf8' ) ;
208
+
209
+ sh . rm ( '-rf' , path . join ( process . cwd ( ) , 'dist' ) ) ;
210
+
211
+ return ng ( [
212
+ 'build' ,
213
+ '--silent'
214
+ ] ) . then ( function ( ) {
215
+ expect ( fs . existsSync ( path . join ( process . cwd ( ) , 'dist' ) ) ) . to . be . equal ( true ) ;
216
+ } ) . catch ( ( err ) => {
217
+ throw new Error ( 'Build failed.' ) ;
218
+ } )
219
+ . finally ( function ( ) {
220
+ // Clean `tmp` folder
221
+ process . chdir ( path . resolve ( root , '..' ) ) ;
222
+ sh . rm ( '-rf' , './tmp' ) ; // tmp.teardown takes too long
223
+ done ( ) ;
224
+ } ) ;
224
225
} ) ;
225
226
226
227
} ) ;
0 commit comments