@@ -12,7 +12,6 @@ const doneRe =
12
12
/ w e b p a c k : b u n d l e i s n o w V A L I D | w e b p a c k : C o m p i l e d s u c c e s s f u l l y .| w e b p a c k : F a i l e d t o c o m p i l e ./ ;
13
13
14
14
15
-
16
15
export default function ( ) {
17
16
if ( process . platform . startsWith ( 'win' ) ) {
18
17
return Promise . resolve ( ) ;
@@ -22,7 +21,7 @@ export default function() {
22
21
return Promise . resolve ( ) ;
23
22
}
24
23
25
- return silentExecAndWaitForOutputToMatch ( 'ng' , [ 'serve' ] , doneRe )
24
+ return Promise . resolve ( )
26
25
// Create and import files.
27
26
. then ( ( ) => writeFile ( 'src/funky2.ts' , `
28
27
export function funky2(value: string): string {
@@ -33,24 +32,24 @@ export default function() {
33
32
export * from './funky2';
34
33
` ) )
35
34
. then ( ( ) => prependToFile ( 'src/main.ts' , `
36
- import { funky } from './funky';
35
+ import { funky2 } from './funky';
37
36
` ) )
38
37
. then ( ( ) => appendToFile ( 'src/main.ts' , `
39
- console.log(funky ('town'));
38
+ console.log(funky2 ('town'));
40
39
` ) )
40
+ . then ( ( ) => wait ( 2000 ) )
41
41
// Should trigger a rebuild, no error expected.
42
- . then ( ( ) => waitForAnyProcessOutputToMatch ( doneRe , 10000 ) )
42
+ . then ( ( ) => silentExecAndWaitForOutputToMatch ( 'ng' , [ 'serve' ] , doneRe ) )
43
43
// Make an invalid version of the file.
44
- . then ( ( ) => wait ( 2000 ) )
45
44
. then ( ( ) => writeFile ( 'src/funky2.ts' , `
46
- export function funky (value: number): number {
45
+ export function funky2 (value: number): number {
47
46
return value + 1;
48
47
}
49
48
` ) )
50
49
// Should trigger a rebuild, this time an error is expected.
51
50
. then ( ( ) => waitForAnyProcessOutputToMatch ( doneRe , 10000 ) )
52
- . then ( ( { stdout } ) => {
53
- if ( ! / E R R O R i n .* \/ s r c \/ m a i n \. t s \( / . test ( stdout ) ) {
51
+ . then ( ( { stderr } ) => {
52
+ if ( ! / E R R O R i n .* \/ s r c \/ m a i n \. t s \( / . test ( stderr ) ) {
54
53
throw new Error ( 'Expected an error but none happened.' ) ;
55
54
}
56
55
} )
@@ -61,20 +60,20 @@ export default function() {
61
60
` ) )
62
61
// Should trigger a rebuild, this time an error is expected.
63
62
. then ( ( ) => waitForAnyProcessOutputToMatch ( doneRe , 10000 ) )
64
- . then ( ( { stdout } ) => {
65
- if ( ! / E R R O R i n .* \/ s r c \/ m a i n \. t s \( / . test ( stdout ) ) {
63
+ . then ( ( { stderr } ) => {
64
+ if ( ! / E R R O R i n .* \/ s r c \/ m a i n \. t s \( / . test ( stderr ) ) {
66
65
throw new Error ( 'Expected an error but none happened.' ) ;
67
66
}
68
67
} )
69
68
// Fix the error!
70
69
. then ( ( ) => writeFile ( 'src/funky2.ts' , `
71
- export function funky (value: string): string {
70
+ export function funky2 (value: string): string {
72
71
return value + 'hello';
73
72
}
74
73
` ) )
75
74
. then ( ( ) => waitForAnyProcessOutputToMatch ( doneRe , 10000 ) )
76
- . then ( ( { stdout } ) => {
77
- if ( / E R R O R i n .* \/ s r c \/ m a i n \. t s \( / . test ( stdout ) ) {
75
+ . then ( ( { stderr } ) => {
76
+ if ( / E R R O R i n .* \/ s r c \/ m a i n \. t s \( / . test ( stderr ) ) {
78
77
throw new Error ( 'Expected no error but an error was shown.' ) ;
79
78
}
80
79
} )
0 commit comments