@@ -16,71 +16,73 @@ const testsVariants: [suitName: string, baseUrl: string | undefined][] = [
16
16
] ;
17
17
18
18
describeBuilder ( buildApplication , APPLICATION_BUILDER_INFO , ( harness ) => {
19
- for ( const [ suitName , baseUrl ] of testsVariants ) {
20
- describe ( suitName , ( ) => {
21
- beforeEach ( async ( ) => {
22
- await harness . modifyFile ( 'tsconfig.json' , ( content ) => {
23
- const tsconfig = JSON . parse ( content ) ;
24
- tsconfig . compilerOptions . baseUrl = baseUrl ;
25
-
26
- return JSON . stringify ( tsconfig ) ;
27
- } ) ;
28
- } ) ;
29
-
30
- it ( 'uses a provided TypeScript file' , async ( ) => {
31
- harness . useTarget ( 'build' , {
32
- ...BASE_OPTIONS ,
33
- polyfills : [ 'src/polyfills.ts' ] ,
19
+ describe ( 'Option: polyfills' , ( ) => {
20
+ for ( const [ suitName , baseUrl ] of testsVariants ) {
21
+ describe ( suitName , ( ) => {
22
+ beforeEach ( async ( ) => {
23
+ await harness . modifyFile ( 'tsconfig.json' , ( content ) => {
24
+ const tsconfig = JSON . parse ( content ) ;
25
+ tsconfig . compilerOptions . baseUrl = baseUrl ;
26
+
27
+ return JSON . stringify ( tsconfig ) ;
28
+ } ) ;
34
29
} ) ;
35
30
36
- const { result } = await harness . executeOnce ( ) ;
31
+ it ( 'uses a provided TypeScript file' , async ( ) => {
32
+ harness . useTarget ( 'build' , {
33
+ ...BASE_OPTIONS ,
34
+ polyfills : [ 'src/polyfills.ts' ] ,
35
+ } ) ;
37
36
38
- expect ( result ?. success ) . toBe ( true ) ;
39
-
40
- harness . expectFile ( 'dist/browser/polyfills.js' ) . toExist ( ) ;
41
- } ) ;
37
+ const { result } = await harness . executeOnce ( ) ;
42
38
43
- it ( 'uses a provided JavaScript file' , async ( ) => {
44
- await harness . writeFile ( 'src/polyfills.js' , `console.log('main');` ) ;
39
+ expect ( result ?. success ) . toBe ( true ) ;
45
40
46
- harness . useTarget ( 'build' , {
47
- ...BASE_OPTIONS ,
48
- polyfills : [ 'src/polyfills.js' ] ,
41
+ harness . expectFile ( 'dist/browser/polyfills.js' ) . toExist ( ) ;
49
42
} ) ;
50
43
51
- const { result } = await harness . executeOnce ( ) ;
44
+ it ( 'uses a provided JavaScript file' , async ( ) => {
45
+ await harness . writeFile ( 'src/polyfills.js' , `console.log('main');` ) ;
52
46
53
- expect ( result ?. success ) . toBe ( true ) ;
47
+ harness . useTarget ( 'build' , {
48
+ ...BASE_OPTIONS ,
49
+ polyfills : [ 'src/polyfills.js' ] ,
50
+ } ) ;
54
51
55
- harness . expectFile ( 'dist/browser/polyfills.js' ) . content . toContain ( `console.log("main")` ) ;
56
- } ) ;
52
+ const { result } = await harness . executeOnce ( ) ;
53
+
54
+ expect ( result ?. success ) . toBe ( true ) ;
57
55
58
- it ( 'fails and shows an error when file does not exist' , async ( ) => {
59
- harness . useTarget ( 'build' , {
60
- ...BASE_OPTIONS ,
61
- polyfills : [ 'src/missing.ts' ] ,
56
+ harness . expectFile ( 'dist/browser/polyfills.js' ) . content . toContain ( `console.log("main")` ) ;
62
57
} ) ;
63
58
64
- const { result, logs } = await harness . executeOnce ( { outputLogsOnFailure : false } ) ;
59
+ it ( 'fails and shows an error when file does not exist' , async ( ) => {
60
+ harness . useTarget ( 'build' , {
61
+ ...BASE_OPTIONS ,
62
+ polyfills : [ 'src/missing.ts' ] ,
63
+ } ) ;
65
64
66
- expect ( result ?. success ) . toBe ( false ) ;
67
- expect ( logs ) . toContain (
68
- jasmine . objectContaining ( { message : jasmine . stringMatching ( 'Could not resolve' ) } ) ,
69
- ) ;
65
+ const { result, logs } = await harness . executeOnce ( { outputLogsOnFailure : false } ) ;
70
66
71
- harness . expectFile ( 'dist/browser/polyfills.js' ) . toNotExist ( ) ;
72
- } ) ;
67
+ expect ( result ?. success ) . toBe ( false ) ;
68
+ expect ( logs ) . toContain (
69
+ jasmine . objectContaining ( { message : jasmine . stringMatching ( 'Could not resolve' ) } ) ,
70
+ ) ;
73
71
74
- it ( 'resolves module specifiers in array' , async ( ) => {
75
- harness . useTarget ( 'build' , {
76
- ...BASE_OPTIONS ,
77
- polyfills : [ 'zone.js' , 'zone.js/testing' ] ,
72
+ harness . expectFile ( 'dist/browser/polyfills.js' ) . toNotExist ( ) ;
78
73
} ) ;
79
74
80
- const { result } = await harness . executeOnce ( ) ;
81
- expect ( result ?. success ) . toBeTrue ( ) ;
82
- harness . expectFile ( 'dist/browser/polyfills.js' ) . toExist ( ) ;
75
+ it ( 'resolves module specifiers in array' , async ( ) => {
76
+ harness . useTarget ( 'build' , {
77
+ ...BASE_OPTIONS ,
78
+ polyfills : [ 'zone.js' , 'zone.js/testing' ] ,
79
+ } ) ;
80
+
81
+ const { result } = await harness . executeOnce ( ) ;
82
+ expect ( result ?. success ) . toBeTrue ( ) ;
83
+ harness . expectFile ( 'dist/browser/polyfills.js' ) . toExist ( ) ;
84
+ } ) ;
83
85
} ) ;
84
- } ) ;
85
- }
86
+ }
87
+ } ) ;
86
88
} ) ;
0 commit comments