@@ -43,15 +43,9 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
4343 vendorChunk : true ,
4444 } ) ;
4545
46- const { result, logs } = await harness . executeOnce ( ) ;
46+ const { result } = await harness . executeOnce ( ) ;
4747
4848 expect ( result ?. success ) . toBe ( true ) ;
49- expect ( logs ) . not . toContain (
50- jasmine . objectContaining ( {
51- message : jasmine . stringMatching ( 'Zone.js does not support native async/await in ES2017+' ) ,
52- } ) ,
53- ) ;
54-
5549 harness . expectFile ( 'dist/main.js' ) . content . not . toMatch ( / \s a s y n c \s / ) ;
5650 harness . expectFile ( 'dist/main.js' ) . content . toContain ( '"from-async-app-function"' ) ;
5751 harness . expectFile ( 'dist/main.js' ) . content . toContain ( '"from-async-js-function"' ) ;
@@ -125,17 +119,46 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
125119 vendorChunk : true ,
126120 } ) ;
127121
128- const { result, logs } = await harness . executeOnce ( ) ;
122+ const { result } = await harness . executeOnce ( ) ;
129123
130124 expect ( result ?. success ) . toBe ( true ) ;
131- expect ( logs ) . not . toContain (
132- jasmine . objectContaining ( {
133- message : jasmine . stringMatching ( 'Zone.js does not support native async/await in ES2017+' ) ,
134- } ) ,
135- ) ;
136-
137125 harness . expectFile ( 'dist/main.js' ) . content . not . toMatch ( / \s a s y n c \s / ) ;
138126 harness . expectFile ( 'dist/main.js' ) . content . toContain ( '"from-async-function"' ) ;
139127 } ) ;
128+
129+ it ( 'downlevels "for await...of" when targetting ES2018+' , async ( ) => {
130+ await harness . modifyFile ( 'src/tsconfig.app.json' , ( content ) => {
131+ const tsconfig = JSON . parse ( content ) ;
132+ if ( ! tsconfig . compilerOptions ) {
133+ tsconfig . compilerOptions = { } ;
134+ }
135+ tsconfig . compilerOptions . target = 'es2020' ;
136+
137+ return JSON . stringify ( tsconfig ) ;
138+ } ) ;
139+
140+ // Add an async function to the project
141+ await harness . writeFile (
142+ 'src/main.ts' ,
143+ `
144+ (async () => {
145+ for await (const o of [1, 2, 3]) {
146+ console.log("for await...of");
147+ }
148+ })();
149+ ` ,
150+ ) ;
151+
152+ harness . useTarget ( 'build' , {
153+ ...BASE_OPTIONS ,
154+ vendorChunk : true ,
155+ } ) ;
156+
157+ const { result } = await harness . executeOnce ( ) ;
158+
159+ expect ( result ?. success ) . toBe ( true ) ;
160+ harness . expectFile ( 'dist/main.js' ) . content . not . toMatch ( / \s a w a i t \s / ) ;
161+ harness . expectFile ( 'dist/main.js' ) . content . toContain ( '"for await...of"' ) ;
162+ } ) ;
140163 } ) ;
141164} ) ;
0 commit comments