Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vitest setup type mismatch with expect in ITestRunner #24

Open
jesserowan opened this issue Aug 7, 2024 · 0 comments
Open

vitest setup type mismatch with expect in ITestRunner #24

jesserowan opened this issue Aug 7, 2024 · 0 comments

Comments

@jesserowan
Copy link

Hi, probably something wrong with my config but can't find any resources to help me out.
Following your readme I get an argument type mismatch from expect. Spent a while last night messing with my config and wasn't able to figure it out. I think it might have to do with my vite or vitest config because I don't seem to have all the methods I should have... but I'm not sure

import { afterEach, vi, expect } from 'vitest'
import { cleanup, waitFor } from '@testing-library/react'
import { MsalReactTesterPlugin } from 'msal-react-tester'
import '@testing-library/jest-dom/vitest'

// expect.extend(matchers);

MsalReactTesterPlugin.init({
  spyOn: vi.spyOn,
  // expect: () => {}, // error goes away
  expect: expect,
  resetAllMocks: vi.resetAllMocks,
  waitingFor: waitFor
})

afterEach(() => {
  cleanup();
})

The error says: Argument type {expect: ExpectStatic, spyOn: {<T, S extends Properties<Required<T>>>(obj: T, methodName: S, accessType: "get"): MockInstance<() => T[S]>, <T, G extends Properties<Required<T>>>(obj: T, methodName: G, accessType: "set"): MockInstance<(arg: T[G]) => void>, <T, M extends Classes<Required<T>> | Methods<Required<T>>>(obj: T, methodName: M): Required<T>[M] extends ({new(...args: infer A): infer R} | ((...args: infer A) => infer R)) ? MockInstance<(this:R, ...args: A) => R> : never}, resetAllMocks: () => VitestUtils, waitingFor: <T>(callback: () => (Promise<T> | T), options?: waitForOptions) => Promise<T>} is not assignable to parameter type ITestRunner | undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant