Skip to content

Expecting Error value wrapped in an Exit would not be equal using @effect/vitest #2820

@steffanek

Description

@steffanek

What version of Effect is running?

3.2.3

What steps can reproduce the bug?

import * as it from "@effect/vitest";
it.addEqualityTesters();

import { Schema } from "@effect/schema";
import { Exit } from "effect";

class SchemaTaggedError extends Schema.TaggedError<SchemaTaggedError>()(
  "SchemaTaggedError",
  {
    msg: Schema.String,
    other: Schema.String,
  }
) {}

it.it("test error", () => {
  it.expect(new SchemaTaggedError({ msg: "a", other: "other" })).toEqual(
    new SchemaTaggedError({ msg: "a", other: "other" })
  );
});

it.it("test exit with string value", () => {
  it.expect(Exit.fail("d")).toEqual(Exit.fail("d"));
});

//This pass, however error values are not the same
it.it("test exit with error value", () => {
  it.expect(
    Exit.fail(new SchemaTaggedError({ msg: "a", other: "other" }))
  ).toEqual(Exit.fail(new SchemaTaggedError({ msg: "b", other: "other" })));
});

What is the expected behavior?

The 3rd test should fail.

What do you see instead?

The 3rd test pass.

Additional information

I'm using latest version as follow:

  • vitest 1.6.0
  • @effect/vitest 0.5.3
  • effect 3.2.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions