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

There is an issue with types for test file #124

Closed
ahmad-everneat opened this issue Mar 25, 2024 · 4 comments
Closed

There is an issue with types for test file #124

ahmad-everneat opened this issue Mar 25, 2024 · 4 comments

Comments

@ahmad-everneat
Copy link

Capture
npm run type-check is giving errors

@aryaemami59
Copy link
Contributor

This issue was caused by Vitest in vitest-dev/vitest#5142, I have submitted a PR to fix this on Vitest's end. I addressed it in this repo on #118, but I might have to put up a separate PR just for the fix. In the meantime you can do this:

const it = test<LocalTestContext>

describe('counter reducer', () => {
  beforeEach<LocalTestContext>((context) => {
    const initialState: CounterSliceState = {
      value: 3,
      status: 'idle',
    }

    const store = makeStore({ counter: initialState })

    context.store = store
  })

@EskiMojo14
Copy link

in all honesty i'm not sure of the benefit of using the context object vs just having a let variable that gets reassigned 😕

@aryaemami59
Copy link
Contributor

@EskiMojo14 We can do that too, we can also use a fixture, I only suggested it because it seemed to fix the problem with the least number of lines changed.

@aryaemami59
Copy link
Contributor

looks like vitest-dev/vitest#5142 was merged so hopefully with the next release of Vitest, this will not be an issue anymore.

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

3 participants