Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: flaky tests #7358

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/config/src/_version.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// This file is auto-generated by the codegen maintenance script
export const PACKAGE_VERSION = "14.0.0-beta.1";
export const PACKAGE_VERSION = "14.0.0-beta.3";
2 changes: 1 addition & 1 deletion packages/zwave-js/src/lib/_version.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// This file is auto-generated by the codegen maintenance script
export const PACKAGE_VERSION = "14.0.0-beta.1";
export const PACKAGE_VERSION = "14.0.0-beta.3";
export const PACKAGE_NAME = "zwave-js";
12 changes: 9 additions & 3 deletions packages/zwave-js/src/lib/driver/Task.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,18 +511,21 @@ test("Waiting tasks are deprioritized over tasks with a higher priority", async
scheduler.start();

const yieldedPromise = createDeferredPromise<void>();
const t1WasStarted = createDeferredPromise<void>();

const task1 = scheduler.queueTask({
priority: TaskPriority.Normal,
task: async function*() {
t1WasStarted.resolve();
order.push("1a");
yield () => yieldedPromise;
order.push("1b");
return;
},
});

await wait(1);
// The test expects that task 1 has started executing before task 2 is queued
await t1WasStarted;

const task2 = scheduler.queueTask({
priority: TaskPriority.High,
Expand Down Expand Up @@ -1208,9 +1211,12 @@ test("The task rejection uses the given error, if any", async (t) => {
const order: string[] = [];
scheduler.start();

const t1WasStarted = createDeferredPromise<void>();

const task1 = scheduler.queueTask({
priority: TaskPriority.Normal,
task: async function*() {
t1WasStarted.resolve();
order.push("1a");
yield () => wait(10);
order.push("1b");
Expand All @@ -1222,8 +1228,8 @@ test("The task rejection uses the given error, if any", async (t) => {
},
});

await wait(1);
// The task should have run to the first yield
// task 1 has run to the first yield
await t1WasStarted;
t.expect(order).toStrictEqual(["1a"]);

await scheduler.removeTasks(
Expand Down
Loading