@@ -2,10 +2,12 @@ import * as Constants from './util/constants';
2
2
import { BuildContext } from './util/interfaces' ;
3
3
import * as helpers from './util/helpers' ;
4
4
import * as build from './build' ;
5
+ import * as buildUtils from './build/util' ;
5
6
6
7
import * as bundle from './bundle' ;
7
8
import * as copy from './copy' ;
8
9
import * as clean from './clean' ;
10
+ import * as deepLinking from './deep-linking' ;
9
11
import * as lint from './lint' ;
10
12
import * as minify from './minify' ;
11
13
import * as ngc from './ngc' ;
@@ -26,8 +28,10 @@ describe('build', () => {
26
28
} ) ;
27
29
} ) ;
28
30
31
+ spyOn ( buildUtils , buildUtils . scanSrcTsFiles . name ) . and . returnValue ( Promise . resolve ( ) ) ;
29
32
spyOn ( bundle , bundle . bundle . name ) . and . returnValue ( Promise . resolve ( ) ) ;
30
33
spyOn ( copy , copy . copy . name ) . and . returnValue ( Promise . resolve ( ) ) ;
34
+ spyOn ( deepLinking , deepLinking . deepLinking . name ) . and . returnValue ( Promise . resolve ( ) ) ;
31
35
spyOn ( minify , minify . minifyCss . name ) . and . returnValue ( Promise . resolve ( ) ) ;
32
36
spyOn ( minify , minify . minifyJs . name ) . and . returnValue ( Promise . resolve ( ) ) ;
33
37
spyOn ( lint , lint . lint . name ) . and . returnValue ( Promise . resolve ( ) ) ;
@@ -50,19 +54,19 @@ describe('build', () => {
50
54
const getBooleanPropertyValueSpy = spyOn ( helpers , helpers . getBooleanPropertyValue . name ) . and . returnValue ( true ) ;
51
55
52
56
return build . build ( context ) . then ( ( ) => {
57
+ expect ( buildUtils . scanSrcTsFiles ) . toHaveBeenCalled ( ) ;
53
58
expect ( helpers . readFileAsync ) . toHaveBeenCalled ( ) ;
54
59
expect ( copy . copy ) . toHaveBeenCalled ( ) ;
60
+ expect ( deepLinking . deepLinking ) . toHaveBeenCalled ( ) ;
55
61
expect ( ngc . ngc ) . toHaveBeenCalled ( ) ;
56
62
expect ( bundle . bundle ) . toHaveBeenCalled ( ) ;
57
63
expect ( minify . minifyJs ) . toHaveBeenCalled ( ) ;
58
64
expect ( sass . sass ) . toHaveBeenCalled ( ) ;
59
65
expect ( minify . minifyCss ) . toHaveBeenCalled ( ) ;
60
66
expect ( lint . lint ) . toHaveBeenCalled ( ) ;
61
- expect ( getBooleanPropertyValueSpy . calls . first ( ) . args [ 0 ] ) . toEqual ( Constants . ENV_ENABLE_LINT ) ;
67
+ expect ( getBooleanPropertyValueSpy . calls . all ( ) [ 1 ] . args [ 0 ] ) . toEqual ( Constants . ENV_ENABLE_LINT ) ;
62
68
63
69
expect ( transpile . transpile ) . not . toHaveBeenCalled ( ) ;
64
- } ) . catch ( err => {
65
- expect ( true ) . toEqual ( false ) ;
66
70
} ) ;
67
71
} ) ;
68
72
@@ -78,20 +82,20 @@ describe('build', () => {
78
82
const getBooleanPropertyValueSpy = spyOn ( helpers , helpers . getBooleanPropertyValue . name ) . and . returnValue ( true ) ;
79
83
80
84
return build . build ( context ) . then ( ( ) => {
85
+ expect ( buildUtils . scanSrcTsFiles ) . toHaveBeenCalled ( ) ;
81
86
expect ( helpers . readFileAsync ) . toHaveBeenCalled ( ) ;
82
87
expect ( copy . copy ) . toHaveBeenCalled ( ) ;
88
+ expect ( deepLinking . deepLinking ) . toHaveBeenCalled ( ) ;
83
89
expect ( transpile . transpile ) . toHaveBeenCalled ( ) ;
84
90
expect ( bundle . bundle ) . toHaveBeenCalled ( ) ;
85
91
expect ( sass . sass ) . toHaveBeenCalled ( ) ;
86
92
expect ( lint . lint ) . toHaveBeenCalled ( ) ;
87
- expect ( getBooleanPropertyValueSpy . calls . first ( ) . args [ 0 ] ) . toEqual ( Constants . ENV_ENABLE_LINT ) ;
93
+ expect ( getBooleanPropertyValueSpy . calls . all ( ) [ 1 ] . args [ 0 ] ) . toEqual ( Constants . ENV_ENABLE_LINT ) ;
88
94
expect ( postprocess . postprocess ) . toHaveBeenCalled ( ) ;
89
95
expect ( preprocess . preprocess ) . toHaveBeenCalled ( ) ;
90
96
expect ( ngc . ngc ) . not . toHaveBeenCalled ( ) ;
91
97
expect ( minify . minifyJs ) . not . toHaveBeenCalled ( ) ;
92
98
expect ( minify . minifyCss ) . not . toHaveBeenCalled ( ) ;
93
- } ) . catch ( err => {
94
- expect ( true ) . toEqual ( false ) ;
95
99
} ) ;
96
100
} ) ;
97
101
@@ -107,20 +111,19 @@ describe('build', () => {
107
111
const getBooleanPropertyValueSpy = spyOn ( helpers , helpers . getBooleanPropertyValue . name ) . and . returnValue ( false ) ;
108
112
109
113
return build . build ( context ) . then ( ( ) => {
114
+ expect ( buildUtils . scanSrcTsFiles ) . toHaveBeenCalled ( ) ;
110
115
expect ( helpers . readFileAsync ) . toHaveBeenCalled ( ) ;
111
116
expect ( copy . copy ) . toHaveBeenCalled ( ) ;
112
117
expect ( transpile . transpile ) . toHaveBeenCalled ( ) ;
113
118
expect ( bundle . bundle ) . toHaveBeenCalled ( ) ;
114
119
expect ( sass . sass ) . toHaveBeenCalled ( ) ;
115
120
expect ( lint . lint ) . not . toHaveBeenCalled ( ) ;
116
- expect ( getBooleanPropertyValueSpy . calls . first ( ) . args [ 0 ] ) . toEqual ( Constants . ENV_ENABLE_LINT ) ;
121
+ expect ( getBooleanPropertyValueSpy . calls . all ( ) [ 1 ] . args [ 0 ] ) . toEqual ( Constants . ENV_ENABLE_LINT ) ;
117
122
expect ( postprocess . postprocess ) . toHaveBeenCalled ( ) ;
118
123
expect ( preprocess . preprocess ) . toHaveBeenCalled ( ) ;
119
124
expect ( ngc . ngc ) . not . toHaveBeenCalled ( ) ;
120
125
expect ( minify . minifyJs ) . not . toHaveBeenCalled ( ) ;
121
126
expect ( minify . minifyCss ) . not . toHaveBeenCalled ( ) ;
122
- } ) . catch ( err => {
123
- expect ( true ) . toEqual ( false ) ;
124
127
} ) ;
125
128
} ) ;
126
129
} ) ;
@@ -190,10 +193,11 @@ describe('test project requirements before building', () => {
190
193
} ) ;
191
194
} ) ;
192
195
193
- it ( 'should succeed if IONIC_TS_CONFIG file contains compilerOptions.sourceMap === true' , ( ) => {
196
+ it ( 'should succeed if IONIC_TS_CONFIG file contains compilerOptions.sourceMap is true' , ( ) => {
194
197
process . env [ Constants . ENV_APP_ENTRY_POINT ] = 'src/app/main.ts' ;
195
198
process . env [ Constants . ENV_TS_CONFIG ] = 'tsConfig.js' ;
196
199
200
+ spyOn ( buildUtils , buildUtils . scanSrcTsFiles . name ) . and . returnValue ( Promise . resolve ( ) ) ;
197
201
spyOn ( bundle , bundle . bundle . name ) . and . returnValue ( Promise . resolve ( ) ) ;
198
202
spyOn ( clean , clean . clean . name ) ;
199
203
spyOn ( copy , copy . copy . name ) . and . returnValue ( Promise . resolve ( ) ) ;
0 commit comments