From 1ae539aac52cd25dec8be35799e9a56bb513a660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Tue, 30 Aug 2022 20:09:58 +0900 Subject: [PATCH] test(es/compat): Add a test for a fixed issue (#5672) --- .../async-to-generator/issue-4486/1/exec.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 crates/swc_ecma_transforms_compat/tests/async-to-generator/issue-4486/1/exec.js diff --git a/crates/swc_ecma_transforms_compat/tests/async-to-generator/issue-4486/1/exec.js b/crates/swc_ecma_transforms_compat/tests/async-to-generator/issue-4486/1/exec.js new file mode 100644 index 00000000000..5898690e31a --- /dev/null +++ b/crates/swc_ecma_transforms_compat/tests/async-to-generator/issue-4486/1/exec.js @@ -0,0 +1,26 @@ +const obj = { + a: 'a', + b: 'b', + c: 'c', + d: 'd', +} + +const wait = n => new Promise(r => setTimeout(r, n)) + +const action = async () => { + + for (let i in obj) { + + // halt for a second + await wait(1000) + + // this one is trouble + wait(1000).then(() => console.log(i)) + + } + + console.log('done') +} + + +action() \ No newline at end of file