@@ -89,7 +89,8 @@ var _exampleBoilerplateFiles = [
89
89
'styles.css' ,
90
90
'systemjs.config.js' ,
91
91
'tsconfig.json' ,
92
- 'tslint.json'
92
+ 'tslint.json' ,
93
+ 'angular-cli.json'
93
94
] ;
94
95
95
96
var _exampleDartWebBoilerPlateFiles = [ 'a2docs.css' , 'styles.css' ] ;
@@ -154,6 +155,24 @@ function excludeDartPaths(paths) {
154
155
return paths . filter ( function ( p ) { return ! isDartPath ( p ) ; } ) ;
155
156
}
156
157
158
+ // Load example config and set defaults
159
+ function getExampleConfig ( appDir ) {
160
+ var exampleConfig = { } ;
161
+ try {
162
+ exampleConfig = fs . readJsonSync ( `${ appDir } /${ _exampleConfigFilename } ` ) ;
163
+ } catch ( e ) { }
164
+
165
+ exampleConfig . build = exampleConfig . build || 'tsc' ;
166
+ exampleConfig . run = exampleConfig . run || 'http-server:e2e' ;
167
+
168
+ // Override config if the cli flag is set for tests
169
+ if ( argv . cli ) {
170
+ exampleConfig . build = 'build:cli' ;
171
+ exampleConfig . run = 'http-server:cli' ;
172
+ }
173
+ return exampleConfig ;
174
+ }
175
+
157
176
/**
158
177
* Run Protractor End-to-End Specs for Doc Samples
159
178
* Alias for 'run-e2e-tests'
@@ -249,11 +268,32 @@ function findAndRunE2eTests(filter, outputFile) {
249
268
localExamplePaths = localExamplePaths . filter ( function ( fn ) {
250
269
return fn . match ( '/' + lang + '(?:-[^/]*)?$' ) != null ;
251
270
} ) ;
271
+
252
272
localExamplePaths . forEach ( function ( examplePath ) {
253
273
examplePaths . push ( examplePath ) ;
254
274
} )
255
275
} ) ;
256
276
277
+ // Filter suites that
278
+ if ( argv . cli ) {
279
+ var cliSuitesSkipped = [ ] ;
280
+ examplePaths = examplePaths . filter ( function ( appDir ) {
281
+ var config = getExampleConfig ( appDir ) ;
282
+ if ( config . skipCli ) { cliSuitesSkipped . push ( appDir ) ; }
283
+ return ! config . skipCli ;
284
+ } ) ;
285
+ if ( cliSuitesSkipped . length > 0 ) {
286
+ var log = [ '' ] ;
287
+ log . push ( `Suites skipped due to "skipCli" in ${ _exampleConfigFilename } :` ) ;
288
+ cliSuitesSkipped . forEach ( function ( val ) {
289
+ log . push ( ' ' + val ) ;
290
+ } ) ;
291
+ log = log . join ( '\n' ) ;
292
+ gutil . log ( log ) ;
293
+ fs . appendFileSync ( outputFile , log ) ;
294
+ }
295
+ }
296
+
257
297
// run the tests sequentially
258
298
var status = { passed : [ ] , failed : [ ] } ;
259
299
return examplePaths . reduce ( function ( promise , examplePath ) {
@@ -275,24 +315,13 @@ function findAndRunE2eTests(filter, outputFile) {
275
315
// fileName; then shut down the example. All protractor output is appended
276
316
// to the outputFile.
277
317
function runE2eTsTests ( appDir , outputFile ) {
278
- // Grab protractor configuration or defaults to systemjs config.
279
- try {
280
- var exampleConfig = fs . readJsonSync ( `${ appDir } /${ _exampleConfigFilename } ` ) ;
281
- } catch ( e ) {
282
- exampleConfig = { } ;
283
- }
284
-
285
- var config = {
286
- build : exampleConfig . build || 'tsc' ,
287
- run : exampleConfig . run || 'http-server:e2e'
288
- } ;
289
-
318
+ var config = getExampleConfig ( appDir ) ;
290
319
var appBuildSpawnInfo = spawnExt ( 'npm' , [ 'run' , config . build ] , { cwd : appDir } ) ;
291
320
var appRunSpawnInfo = spawnExt ( 'npm' , [ 'run' , config . run , '--' , '-s' ] , { cwd : appDir } ) ;
292
321
293
322
var run = runProtractor ( appBuildSpawnInfo . promise , appDir , appRunSpawnInfo , outputFile ) ;
294
323
295
- if ( fs . existsSync ( appDir + '/aot/index.html' ) ) {
324
+ if ( fs . existsSync ( appDir + '/aot/index.html' ) && ! argv . cli ) {
296
325
run = run . then ( ( ) => runProtractorAoT ( appDir , outputFile ) ) ;
297
326
}
298
327
return run ;
0 commit comments