Skip to content

Commit

Permalink
fix: update message
Browse files Browse the repository at this point in the history
  • Loading branch information
btea committed Mar 26, 2024
1 parent 2251ee6 commit b00fc37
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/expect/src/jest-expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export const JestChaiExpect: ChaiPlugin = (chai, utils) => {
def('toMatch', function (expected: string | RegExp) {
const actual = this._obj as string
if (typeof actual !== 'string')
throw new TypeError(`.toMatch() expects to received a string, got ${typeof actual}`)
throw new TypeError(`.toMatch() expects to receive a string, but got ${typeof actual}`)

return this.assert(
typeof expected === 'string'
Expand Down
2 changes: 1 addition & 1 deletion test/core/test/jest-expect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe('jest-expect', () => {
expect(0.2 + 0.1).toBeCloseTo(0.3, 5)
expect(0.2 + 0.1).not.toBeCloseTo(0.3, 100) // expect.closeTo will fail in chai

expect(() => expect(1).toMatch(/\d/)).toThrowErrorMatchingInlineSnapshot(`[TypeError: .toMatch() expects to received a string, got number]`)
expect(() => expect(1).toMatch(/\d/)).toThrowErrorMatchingInlineSnapshot(`[TypeError: .toMatch() expects to receive a string, but got number]`)
})

it('asymmetric matchers (jest style)', () => {
Expand Down

0 comments on commit b00fc37

Please sign in to comment.