vitest-dev / vitest-dev/vitest

UnhandledRejection: process.memoryUsage

Open
#6,500 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

p2-nice-to-have
Dominant language
TypeScript
Stars
17.1k
Forks
2k
Avg merge
1d 22h
Merged PRs (30d)
94

Description

Describe the bug

𝐇ello˙. 𝐀m 𝐈 doing something wrong˙? ಥ_ಥ

Run the following script:

"test:browser": "vitest run",

It runs correctly. (。◕‿‿◕。)


Run the following script:

"test:browser-flaky": "vitest run --browser.enabled=true",

Message output in console ⚆ _ ⚆
❯ npm run test:browser-flaky

> test:browser-flaky
> vitest run --browser.enabled=true


 RUN  v2.1.1 /home/projects/vitest-dev-vitest-gmzfxl
      Browser runner started at http://localhost:5173/
      Coverage enabled with v8


⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

Vitest caught 2 unhandled errors during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Coverage Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: CDP is not supported by the provider "preview".
 ❯ receiverOnMessage node_modules/ws/lib/websocket.js:1220:20
 ❯ dataMessage node_modules/ws/lib/receiver.js:596:14
 ❯ getData node_modules/ws/lib/receiver.js:496:10
 ❯ startLoop node_modules/ws/lib/receiver.js:167:16
 ❯ _write node_modules/ws/lib/receiver.js:94:10
 ❯ socketOnData node_modules/ws/lib/websocket.js:1355:35
 ❯ _0x26b1b3/< ../../../blitz.28a8ce1b.js:40:516951
 ❯ _0x4d0c70/< ../../../blitz.28a8ce1b.js:40:518489
 ❯ _0x132427/< ../../../blitz.28a8ce1b.js:40:195670
 ❯ _0x4f7512 ../../../blitz.28a8ce1b.js:40:195775
 ❯ _0x4d0c70 ../../../blitz.28a8ce1b.js:40:518414
 ❯ _0x3e05c5/< ../../../blitz.28a8ce1b.js:40:519146
 ❯ _0x3e05c5 ../../../blitz.28a8ce1b.js:40:519125
 ❯ _0x1a4990 ../../../blitz.28a8ce1b.js:40:518751
 ❯ _0x38702d ../../../blitz.28a8ce1b.js:40:517760


⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: CDP is not supported by the provider "preview".
 ❯ receiverOnMessage node_modules/ws/lib/websocket.js:1220:20
 ❯ dataMessage node_modules/ws/lib/receiver.js:596:14
 ❯ getData node_modules/ws/lib/receiver.js:496:10
 ❯ startLoop node_modules/ws/lib/receiver.js:167:16
 ❯ _write node_modules/ws/lib/receiver.js:94:10
 ❯ socketOnData node_modules/ws/lib/websocket.js:1355:35
 ❯ _0x26b1b3/< ../../../blitz.28a8ce1b.js:40:516951
 ❯ _0x4d0c70/< ../../../blitz.28a8ce1b.js:40:518489
 ❯ _0x132427/< ../../../blitz.28a8ce1b.js:40:195670
 ❯ _0x4f7512 ../../../blitz.28a8ce1b.js:40:195775
 ❯ _0x4d0c70 ../../../blitz.28a8ce1b.js:40:518414
 ❯ _0x3e05c5/< ../../../blitz.28a8ce1b.js:40:519146
 ❯ _0x3e05c5 ../../../blitz.28a8ce1b.js:40:519125
 ❯ _0x1a4990 ../../../blitz.28a8ce1b.js:40:518751
 ❯ _0x38702d ../../../blitz.28a8ce1b.js:40:517760

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 Test Files  no tests
      Tests  no tests
     Errors  2 errors
   Start at  17:31:33
   Duration  12.91s (transform 0ms, setup 0ms, collect 0ms, tests 0ms, environment 0ms, prepare 0ms)

 % @vitest/coverage-v8 does not work on Stackblitz. Report will be empty.
 % Coverage report from v8
-------------|---------|----------|---------|---------|-------------------
File         | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
-------------|---------|----------|---------|---------|-------------------
All files    |       0 |        0 |       0 |       0 |                   
 ...t-gmzfxl |       0 |        0 |       0 |       0 |                   
  ...nfig.js |       0 |        0 |       0 |       0 | 1-31              
 ...zfxl/src |       0 |        0 |       0 |       0 |                   
  index.js   |       0 |        0 |       0 |       0 | 1-2               
  ...test.js |       0 |        0 |       0 |       0 | 1-9               
-------------|---------|----------|---------|---------|-------------------
[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "TypeError: this.server is undefined".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v18.20.3

Run the following script:

"test:browser-error": "vitest run --browser.enabled=true --coverage.enabled=false"

Message output in console ⚆ _ ⚆
❯ npm run test:browser-error

> test:browser-error
> vitest run --browser.enabled=true --coverage.enabled=false


 RUN  v2.1.1 /home/projects/vitest-dev-vitest-gmzfxl
      Browser runner started at http://localhost:5173/

 · src/index.test.js (1)
   · config needs to be object

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

Vitest caught 1 unhandled error during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
TypeError: process.memoryUsage is not a function
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 Test Files   (1)
      Tests   (1)
     Errors  1 error
   Start at  17:34:48
   Duration  7.55s (transform 0ms, setup 0ms, collect 61ms, tests 0ms, environment 0ms, prepare 40ms)
Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-gmzfxl?file=package.json

System Info
System:
    OS: Linux 6.8 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
    CPU: (1) Intel Celeron 352
    Memory: 1.66 GB / 15.35 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 22.8.0 - ~/.nvm/versions/node/v22.8.0/bin/node
    npm: 10.8.2 - ~/.nvm/versions/node/v22.8.0/bin/npm
Used Package Manager

npm

Validations

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the scripts in package.json and reproduce the browser runs from the linked StackBlitz example, comparing the coverage-enabled and coverage-disabled commands. Use src/index.test.js and the browser runner entry points mentioned by the output to trace the unhandled errors; done means the test run completes without the reported process.memoryUsage or rejection errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.