Skip to content

Commit

Permalink
fix: Vitest matcher integration (#3477)
Browse files Browse the repository at this point in the history
* fix: vitest matcher setup

* chore: changeset

* chore: fix issue with expect import

* chore: release to npm

* chore: remove release tag

* chore: added peer dependency

* chroe: lock
  • Loading branch information
petertonysmith94 authored Dec 13, 2024
1 parent efdf9a1 commit 0970bc4
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 168 deletions.
5 changes: 5 additions & 0 deletions .changeset/popular-wasps-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fuel-ts/utils": patch
---

fix: Vitest matcher integration
3 changes: 3 additions & 0 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,8 @@
"@fuel-ts/math": "workspace:*",
"@fuel-ts/versions": "workspace:*",
"fflate": "^0.8.2"
},
"peerDependencies": {
"vitest": "~2.0.5"
}
}
3 changes: 2 additions & 1 deletion packages/utils/src/test-utils/vitest.matchers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { bn } from '@fuel-ts/math';
import type { BN, BNInput } from '@fuel-ts/math';
import type { ExpectStatic as GlobalExpectStatic } from 'vitest';

interface Matchers<R = BN> {
toEqualBn: (expected: BNInput) => R;
Expand All @@ -12,7 +13,7 @@ declare module 'vitest' {
}
}

export const setupTestMatchers = () => {
export const setupTestMatchers = (expect: GlobalExpectStatic) => {
expect.extend({
toEqualBn(received: BNInput, expected: BNInput) {
const actualBn = bn(received);
Expand Down
Loading

0 comments on commit 0970bc4

Please sign in to comment.