1describe("unittests:: evaluation:: awaiter", () => { 2 // NOTE: This could break if the ECMAScript spec ever changes the timing behavior for Promises (again) 3 it("await (es5)", async () => { 4 const result = evaluator.evaluateTypeScript(` 5 async function a(msg: string) { 6 await Promise.resolve(); 7 output.push(msg); 8 } 9 function b(msg: string) { 10 return Promise.resolve().then(() => { 11 output.push(msg); 12 }); 13 } 14 export const output: string[] = []; 15 export async function main() { 16 const p1 = a('1'); 17 const p2 = b('2'); 18 await Promise.all([p1, p2]); 19 } 20 `); 21 await result.main(); 22 assert.deepEqual(result.output, ["1", "2"]); 23 }); 24}); 25