Skip to content

bug(@golevelup/ts-jest): Cannot convert object to primitive value at RegExp.test #816

@Michsior14

Description

@Michsior14

In all versions after 0.5.0 if somewhere in the code the RegExp.test is used on mocked object property then tests fails.
This can be simply reproduced using bellow test snipped, by e.g. putting it in packages/testing/ts-jest/src/mocks.spec.ts.

it('should work with RegExp', () => {
  type SimpleType = {
    field: string;
  };
  const mock = createMock<SimpleType>();
  expect(/test/.test(mock.field));
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions