AssertionError: promise resolved “undefined” instead of rejecting

I have these functions

export async function doStuff1(): Promise<void> {
  const a = 2;
  match(a).with(2, async () => {
    await doStuff2();
  });

  console.log("not implemented");
}

export async function doStuff2(): Promise<void> {
  throw new Error("not implemented");
}

and this in the tests

await expect(
   doStuff1()
).rejects.toThrowError(Error);

The test fails and it says Vitest caught 1 unhandled error during the test run. and AssertionError: promise resolved "undefined" instead of rejecting.

What am I doing wrong? If I replace my match with a simple if/else the test works fine.