Open
Description
User story
As a testing engineer I want to be able to write test cases that only include type tests.
Example test:
import { assertType, expectTypeOf, describe, it } from 'vitest'
import { mount } from './types.s'
describe('', () => {
it('my types work properly', () => {. // 👈 this is failing because of a violation of `vitest/expect-expect`
expectTypeOf(mount).toBeFunction()
expectTypeOf(mount).parameter(0).toMatchTypeOf<{ name: string }>()
// @ts-expect-error name is a string
assertType(mount({ name: 42 }))
})
})
This violates the vitest/expect-expect rule in the current configuration.
Acceptance criteria
- A test case containing only
expectTypeOf
should pass thevitest/expect-expect
rule
Minimal reproduction of current behaviour
import { assertType, expectTypeOf, describe, it } from 'vitest'
import { mount } from './types.s'
describe('', () => {
// eslint-disable-next-line vitest/expect-expect // 👈 needed to pass lint target
it('my types work properly', () => {
expectTypeOf(mount).toBeFunction()
expectTypeOf(mount).parameter(0).toMatchTypeOf<{ name: string }>()
// @ts-expect-error name is a string
assertType(mount({ name: 42 }))
})
})
Desired behaviour showcase
import { assertType, expectTypeOf, describe, it } from 'vitest'
import { mount } from './types.s'
describe('', () => {
it('my types work properly', () => { // 👈 lint target passed without disabling rules
expectTypeOf(mount).toBeFunction()
expectTypeOf(mount).parameter(0).toMatchTypeOf<{ name: string }>()
// @ts-expect-error name is a string
assertType(mount({ name: 42 }))
})
})
Which configuration is this related to?
vitest
ESLint version
No response
Metadata
Metadata
Assignees
Labels
No labels