diff --git a/packages/vitest/src/index.ts b/packages/vitest/src/index.ts
index 0801dd93bc38..35db361a9f94 100644
--- a/packages/vitest/src/index.ts
+++ b/packages/vitest/src/index.ts
@@ -122,15 +122,15 @@ declare global {
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore build namspace conflict
- type VitestAssertion = {
+ type VitestAssertion = {
[K in keyof A]: A[K] extends Chai.Assertion
- ? Assertion
+ ? Assertion
: A[K] extends (...args: any[]) => any
? A[K] // not converting function since they may contain overload
- : VitestAssertion
- }
+ : VitestAssertion
+ } & ((type: string, message?: string) => Assertion)
- interface Assertion extends VitestAssertion, JestAssertion {
+ interface Assertion extends VitestAssertion, JestAssertion {
resolves: Promisify>
rejects: Promisify>
}
diff --git a/test/core/test/basic.test.ts b/test/core/test/basic.test.ts
index b646ce3220e4..dad3e931880c 100644
--- a/test/core/test/basic.test.ts
+++ b/test/core/test/basic.test.ts
@@ -25,6 +25,12 @@ test('JSON', () => {
assert.deepEqual(JSON.parse(output), input, 'matches original')
})
+test('assertion is callable', () => {
+ const str = '13'
+ expect(str).to.be.a('string')
+ expect(str).not.to.be.a('number')
+})
+
const hi = suite('suite')
hi.test('expect truthy', () => {