Skip to content

Commit bc37d2d

Browse files
happykawayigtGuan Tong
andauthored
fix(valid-expect): support expect.assert members (#936)
Co-authored-by: Guan Tong <tguan@gmail.com>
1 parent 1a0fdaf commit bc37d2d

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎src/utils/parse-vitest-fn-call.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,9 @@ const classifyExpectChain = (
308308
return { kind: 'matcher', member, callExpression }
309309
}
310310

311+
if (isFirstMemberOfStaticExpectCall && name === 'assert')
312+
return { kind: 'expect-api', member, callExpression }
313+
311314
if (chaiChainableProperties.has(name))
312315
return { kind: 'language-chain', member, callExpression }
313316

‎tests/valid-expect.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ ruleTester.run(rule.name, rule, {
55
valid: [
66
'expect.hasAssertions',
77
'expect.hasAssertions()',
8+
'expect.assert(value)',
9+
'expect.assert.isDefined(value)',
10+
'expect.assert.exists(value)',
811
'expect.any(String)',
912
'expect.anything()',
1013
'expect.arrayContaining([1])',

0 commit comments

Comments
 (0)