Skip to content

Commit

Permalink
fix!: update dependency chai to v5 (#5135)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Vladimir Sheremet <sleuths.slews0s@icloud.com>
  • Loading branch information
renovate[bot] and sheremet-va committed May 9, 2024
1 parent a99a14c commit 73646b6
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 34 deletions.
2 changes: 1 addition & 1 deletion packages/expect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"dependencies": {
"@vitest/spy": "workspace:*",
"@vitest/utils": "workspace:*",
"chai": "^4.3.10"
"chai": "^5.0.3"
},
"devDependencies": {
"@types/chai": "4.3.6",
Expand Down
8 changes: 4 additions & 4 deletions packages/expect/src/jest-extend.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { util } from 'chai'
import { use, util } from 'chai'
import type {
ChaiPlugin,
ExpectStatic,
Expand Down Expand Up @@ -55,8 +55,8 @@ class JestExtendError extends Error {
}
}

function JestExtendPlugin(expect: ExpectStatic, matchers: MatchersObject): ChaiPlugin {
return (c, utils) => {
function JestExtendPlugin(c: Chai.ChaiStatic, expect: ExpectStatic, matchers: MatchersObject): ChaiPlugin {
return (_, utils) => {
Object.entries(matchers).forEach(([expectAssertionName, expectAssertion]) => {
function expectWrapper(this: Chai.AssertionStatic & Chai.Assertion, ...args: any[]) {
const { state, isNot, obj } = getMatcherState(this, expect)
Expand Down Expand Up @@ -139,6 +139,6 @@ function JestExtendPlugin(expect: ExpectStatic, matchers: MatchersObject): ChaiP

export const JestExtend: ChaiPlugin = (chai, utils) => {
utils.addMethod(chai.expect, 'extend', (expect: ExpectStatic, expects: MatchersObject) => {
chai.use(JestExtendPlugin(expect, expects))
use(JestExtendPlugin(chai, expect, expects))
})
}
2 changes: 1 addition & 1 deletion packages/vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
"@vitest/snapshot": "workspace:*",
"@vitest/spy": "workspace:*",
"@vitest/utils": "workspace:*",
"chai": "^4.3.10",
"chai": "^5.1.0",
"debug": "^4.3.4",
"execa": "^8.0.1",
"magic-string": "^0.30.5",
Expand Down
70 changes: 42 additions & 28 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test/reporters/tests/__snapshots__/html.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ exports[`html reporter > resolves to "failing" status for test file "json-fail"
"message": "expected 2 to deeply equal 1",
"name": "AssertionError",
"nameStr": "AssertionError",
"ok": false,
"operator": "strictEqual",
"showDiff": true,
"stack": "AssertionError: expected 2 to deeply equal 1",
Expand Down

0 comments on commit 73646b6

Please sign in to comment.