Troubleshooting Unit Test for `Exit.fail` Assertion in `@effect/vitest`

Hey!

I'm trying to write a simple unit test which tries to assert the error inside of an Exit.fail, the toStrictEqual seems to not really work correctly. I'm using @effect/vitest, I have seen in some other threads that I am supposed to run it.addEqualityTesters(), which I have done, but I am obviously doing something wrong as this test below is simply passing even though it should definitely fail.

Any help or pointers are appreciated :)

  it.effect("should fail", () =>
    Effect.gen(function* () {
      const result = yield* someFunc().pipe(Effect.exit);
      const want = Exit.fail(new SomeTaggedError({ cause: expect.anything() }));

      console.log({
        result: JSON.stringify(result, null, 2),
        want: JSON.stringify(want, null, 2),
      });

      expect(result).toStrictEqual(want);
    }),
  );
Was this page helpful?