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 0.31.0 breaks vi.fn #3340

Closed
6 tasks done
bc-m opened this issue May 10, 2023 · 2 comments · Fixed by #3341
Closed
6 tasks done

vitest 0.31.0 breaks vi.fn #3340

bc-m opened this issue May 10, 2023 · 2 comments · Fixed by #3341
Labels
duplicate This issue or pull request already exists

Comments

@bc-m
Copy link

bc-m commented May 10, 2023

Describe the bug

Using vi.fn in vi.mock not working anymore after upgrading to vitest 0.31.0. The function with vi.fn returns only undefined, ignoring the own implementation.

I have attached two Stackblitz examples with two test files, one with vi.fn', the other without. You will see that on v0.30.0 both variants work, after upgrading to v0.31.0 only the one without vi.fn` works.

Reproduction

System Info

From stackblitz:
  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 7.17.0 - /usr/local/bin/npm
  npmPackages:
    vite: 4.3.5 => 4.3.5 
    vitest: ^0.31.0 => 0.31.0

Used Package Manager

npm

Validations

@stackblitz
Copy link

stackblitz bot commented May 10, 2023

@sheremet-va
Copy link
Member

Stackblitz doesn't even call vi.mock, but locally it works 🤔

This issue is probably a duplicate of #3335

@sheremet-va sheremet-va added the duplicate This issue or pull request already exists label May 10, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jun 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants