From ba483b6e2cfe8c2e34c990504e4a89e584d6f30a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 31 Oct 2019 11:32:27 +0100 Subject: [PATCH] [FIX] component tests: make them work on windows For an unknown reason, it looks like the way ticks, micro task ticks or other subtle scheduling issues are different on a windows machine (it may be because of other difference, such as a specific version of nodejs). Anyway, I could not find the cause of the issue, but simply waiting an extra microtask tick seems to work. --- tests/component/component.test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/component/component.test.ts b/tests/component/component.test.ts index 001f3de4..fecd99c3 100644 --- a/tests/component/component.test.ts +++ b/tests/component/component.test.ts @@ -2683,12 +2683,19 @@ describe("async rendering", () => { await nextMicroTick(); expect(steps).toEqual(["render"]); await nextMicroTick(); + // For an unknown reason, this test fails on windows without the next microtick. It works + // in linux and osx, but fails on at least this machine. + // I do not see anything harmful in waiting an extra tick. But it is annoying to not + // know what is different. + await nextMicroTick(); expect(steps).toEqual(["render", "render"]); expect(fixture.innerHTML).toBe("
1
"); parent.state.valA = 3; await nextMicroTick(); expect(steps).toEqual(["render", "render"]); await nextMicroTick(); + // same as above + await nextMicroTick(); expect(steps).toEqual(["render", "render", "render"]); expect(fixture.innerHTML).toBe("
1
"); await nextTick();