1
1
import { killAllProcesses } from '../../utils/process' ;
2
2
import { request } from '../../utils/http' ;
3
- import { ngServe } from '../../utils/project' ;
3
+ import { ngServe , updateJsonFile } from '../../utils/project' ;
4
4
import { getGlobalVariable } from '../../utils/env' ;
5
+ import { writeMultipleFiles } from '../../utils/fs' ;
5
6
6
7
export default function ( ) {
7
8
// Skip this in Appveyor tests.
@@ -10,18 +11,29 @@ export default function () {
10
11
}
11
12
12
13
return Promise . resolve ( )
14
+ . then ( ( ) => writeMultipleFiles ( {
15
+ 'src/string-script.js' : 'console.log(\'string-script\'); var number = 1+1;' ,
16
+ } )
17
+ . then ( ( ) => updateJsonFile ( '.angular-cli.json' , configJson => {
18
+ configJson [ 'apps' ] [ 'scripts' ] = [
19
+ 'string-script.js' ,
20
+ ] ;
21
+ } ) )
13
22
// check when setup through command line arguments
14
23
. then ( ( ) => ngServe ( '--deploy-url' , '/deployurl/' , '--base-href' , '/deployurl/' ) )
15
24
. then ( ( ) => request ( 'http://localhost:4200' ) )
16
25
. then ( body => {
17
26
if ( ! body . match ( / < a p p - r o o t > < \/ a p p - r o o t > / ) ) {
18
- throw new Error ( 'Response does not match expected value.' ) ;
27
+ throw new Error ( 'Response does not match expected value. (1)' ) ;
28
+ }
29
+ if ( ! body . match ( / " \/ d e p l o y u r l \/ s c r i p t s .b u n d l e .j s " / ) ) {
30
+ throw new Error ( 'Response does not match expected value. (2)' ) ;
19
31
}
20
32
} )
21
33
. then ( ( ) => request ( 'http://localhost:4200/deployurl/' ) )
22
34
. then ( body => {
23
35
if ( ! body . match ( / < a p p - r o o t > < \/ a p p - r o o t > / ) ) {
24
- throw new Error ( 'Response does not match expected value.' ) ;
36
+ throw new Error ( 'Response does not match expected value. (3) ' ) ;
25
37
}
26
38
} )
27
39
. then ( ( ) => killAllProcesses ( ) , ( err ) => { killAllProcesses ( ) ; throw err ; } ) ;
0 commit comments