Improving readability of failed test output for `it.effect` in `@effect/vitest`

Hey folks, I noticed when using @effect/vitest it.effect
  it.effect("should mutation input argument be invalid", () =>
    Effect.gen(function* () {
      // Act
      const result = yield* testGraphql(
        portfolioUpdate,
        { input: { id: "123", name: "new name" } },
        adminPermissions
      );

      // Assert
      expect(result).toStrictEqual({
        data: null,
        errors: [
          new GraphQLError(
            `Error: Validation ({ readonly id: (string | number <-> ObjectId); readonly name?: a non empty string | null | undefined; readonly positionsInAmount?: boolean | null | undefined } <-> { readonly _id: ObjectId; readonly name?: string | undefined; readonly positions_in_amount?: boolean | undefined })
└─ Encoded side transformation failure
   └─ { readonly id: (string | number <-> ObjectId); readonly name?: a non empty string | null | undefined; readonly positionsInAmount?: boolean | null | undefined }
      └─ ["id"]
         └─ (string | number <-> ObjectId)
            └─ Transformation process failure
               └─ input must be a 24 character hex string, 12 byte Uint8Array, or an integer`
          ),
        ],
      });
    }).pipe(Effect.provide(TestLayer))
  );

the failed test output looks not readable:
 FAIL  test/graphql/portfolio.test.ts > portfolio > should mutation input argument be invalid
Unknown Error: AssertionError: expected { …(2) } to strictly equal { data: null, errors: [ …(1) ] }
 ❯ next test/graphql/portfolio.test.ts:120:22
    118| 
    119|       // Assert
    120|       expect(result).toStrictEqual({
       |                      ^
    121|         data: null,
    122|         errors: [
Was this page helpful?