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

error with vi.mock('axios') #284

Closed
6 tasks done
jerrywu001 opened this issue Dec 23, 2021 · 4 comments
Closed
6 tasks done

error with vi.mock('axios') #284

jerrywu001 opened this issue Dec 23, 2021 · 4 comments

Comments

@jerrywu001
Copy link

Describe the bug

error with vi.mock('axios')

Reproduction

https://stackblitz.com/edit/node-m7f8xj?file=test%2Faxios.test.ts

System Info

System:
    OS: Linux undefined
    CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: Unknown - /bin/jsh
  Binaries:
    Node: 14.16.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /bin/yarn
    npm: 7.17.0 - /bin/npm
  npmPackages:
    vite: ^2.7.4 => 2.7.4 
    vitest: ^0.0.104 => 0.0.104

Used Package Manager

npm

Logs

- axios.test.ts
RangeError: Maximum call stack size exceeded
 ❯ eval node_modules/vitest/dist/entry.js:3973:28
 ❯ serializeError node_modules/vitest/dist/entry.js:3973:20
 ❯ eval node_modules/vitest/dist/entry.js:3974:16
 ❯ serializeError node_modules/vitest/dist/entry.js:3973:20
 ❯ eval node_modules/vitest/dist/entry.js:3974:16
 ❯ serializeError node_modules/vitest/dist/entry.js:3973:20
 ❯ eval node_modules/vitest/dist/entry.js:3974:16

Validations

@Uninen
Copy link

Uninen commented Dec 27, 2021

I'm running into this same issue. After the recent changes, the error changed from the Maximum call stack size exceeded to:

node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^
TypeError [Error]: listeners[i].apply is not a function
    at Socket.emit (node:events:402:35)
    at TCP.<anonymous> (node:net:687:12)
error Command failed with exit code 1.

Using Vite 2.7.7 and Vitest 0.0.118.

@sheremet-va
Copy link
Member

should be fixed in the next release

@Uninen
Copy link

Uninen commented Dec 29, 2021

I get the same exact error message w/ Vitest v0.0.119.

Nevermind -- I had deleted the __mocks__-folder. Mocking axios works w/ v0.0.119 when configured properly 👍

@jerrywu001
Copy link
Author

I get the same exact error message w/ Vitest v0.0.119.

Nevermind -- I had deleted the __mocks__-folder. Mocking axios works w/ v0.0.119 when configured properly 👍

need mocks

JakeGinnivan pushed a commit to JakeGinnivan/vitest that referenced this issue Jan 8, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jun 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants