@@ -48,6 +48,8 @@ describe('build', () => {
4848 runAot : true
4949 } ;
5050
51+ const getBooleanPropertyValueSpy = spyOn ( helpers , helpers . getBooleanPropertyValue . name ) . and . returnValue ( true ) ;
52+
5153 return build . build ( context ) . then ( ( ) => {
5254 expect ( helpers . readFileAsync ) . toHaveBeenCalled ( ) ;
5355 expect ( copy . copy ) . toHaveBeenCalled ( ) ;
@@ -57,9 +59,11 @@ describe('build', () => {
5759 expect ( sass . sass ) . toHaveBeenCalled ( ) ;
5860 expect ( minify . minifyCss ) . toHaveBeenCalled ( ) ;
5961 expect ( lint . lint ) . toHaveBeenCalled ( ) ;
62+ expect ( getBooleanPropertyValueSpy . calls . first ( ) . args [ 0 ] ) . toEqual ( Constants . ENV_ENABLE_LINT ) ;
6063
6164 expect ( transpile . transpile ) . not . toHaveBeenCalled ( ) ;
6265 } ) . catch ( err => {
66+ console . log ( 'err: ' , err . message ) ;
6367 expect ( true ) . toEqual ( false ) ;
6468 } ) ;
6569 } ) ;
@@ -73,13 +77,45 @@ describe('build', () => {
7377 runAot : false
7478 } ;
7579
80+ const getBooleanPropertyValueSpy = spyOn ( helpers , helpers . getBooleanPropertyValue . name ) . and . returnValue ( true ) ;
81+
7682 return build . build ( context ) . then ( ( ) => {
7783 expect ( helpers . readFileAsync ) . toHaveBeenCalled ( ) ;
7884 expect ( copy . copy ) . toHaveBeenCalled ( ) ;
7985 expect ( transpile . transpile ) . toHaveBeenCalled ( ) ;
8086 expect ( bundle . bundle ) . toHaveBeenCalled ( ) ;
8187 expect ( sass . sass ) . toHaveBeenCalled ( ) ;
8288 expect ( lint . lint ) . toHaveBeenCalled ( ) ;
89+ expect ( getBooleanPropertyValueSpy . calls . first ( ) . args [ 0 ] ) . toEqual ( Constants . ENV_ENABLE_LINT ) ;
90+ expect ( postprocess . postprocess ) . toHaveBeenCalled ( ) ;
91+ expect ( preprocess . preprocess ) . toHaveBeenCalled ( ) ;
92+ expect ( ngc . ngc ) . not . toHaveBeenCalled ( ) ;
93+ expect ( minify . minifyJs ) . not . toHaveBeenCalled ( ) ;
94+ expect ( minify . minifyCss ) . not . toHaveBeenCalled ( ) ;
95+ } ) . catch ( err => {
96+ expect ( true ) . toEqual ( false ) ;
97+ } ) ;
98+ } ) ;
99+
100+ it ( 'should skip lint' , ( ) => {
101+ let context : BuildContext = {
102+ isProd : false ,
103+ optimizeJs : false ,
104+ runMinifyJs : false ,
105+ runMinifyCss : false ,
106+ runAot : false
107+ } ;
108+
109+ const getBooleanPropertyValueSpy = spyOn ( helpers , helpers . getBooleanPropertyValue . name ) . and . returnValue ( false ) ;
110+
111+ return build . build ( context ) . then ( ( ) => {
112+ expect ( helpers . readFileAsync ) . toHaveBeenCalled ( ) ;
113+ expect ( copy . copy ) . toHaveBeenCalled ( ) ;
114+ expect ( transpile . transpile ) . toHaveBeenCalled ( ) ;
115+ expect ( bundle . bundle ) . toHaveBeenCalled ( ) ;
116+ expect ( sass . sass ) . toHaveBeenCalled ( ) ;
117+ expect ( lint . lint ) . not . toHaveBeenCalled ( ) ;
118+ expect ( getBooleanPropertyValueSpy . calls . first ( ) . args [ 0 ] ) . toEqual ( Constants . ENV_ENABLE_LINT ) ;
83119 expect ( postprocess . postprocess ) . toHaveBeenCalled ( ) ;
84120 expect ( preprocess . preprocess ) . toHaveBeenCalled ( ) ;
85121 expect ( ngc . ngc ) . not . toHaveBeenCalled ( ) ;
0 commit comments