Skip to content

ReferenceError: Cannot access 'dispose' before initialization. #8232

Description

@crabvk

Describe the bug

The bug only reproducible using Bun. With Node Vitest works just fine.
I'm using Bun version 1.2.17 and trying to run several small tests in the test directory in my project.

bun run -b vitest run --dir test

The -b flag here means:

Force a script or package to use Bun's runtime instead of Node.js

No tests are run, instead I'm getting this error:

ReferenceError: Cannot access 'dispose' before initialization.
 ❯ disposeInternalListeners node_modules/vitest/dist/chunks/utils.CAioKnHs.js:20:19
 ❯ execute node_modules/vitest/dist/worker.js:70:2
 ❯ execute node_modules/vitest/dist/worker.js:69:24
 ❯ onMessage node_modules/tinypool/dist/entry/process.js:39:24
 ❯ processTicksAndRejections native:7:39
 ❯ spawnSync node:child_process:226:22
 ❯ execSync node:child_process:275:109
 ❯ node_modules/tinypool/dist/index.js:30:19
 ❯ moduleEvaluation native:1:11

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-63jqfvag

System Info

System:
    OS: Linux 6.15 Artix Linux
    CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor
    Memory: 19.66 GB / 31.25 GB
    Container: Yes
    Shell: 4.0.2 - /usr/bin/fish
  Binaries:
    Node: 24.2.0 - /usr/bin/node
    npm: 11.4.2 - /usr/bin/npm
    bun: 1.2.17 - ~/.local/share/mise/installs/bun/1.2.17/bin/bun
  Browsers:
    Chromium: 138.0.7204.49
  npmPackages:
    @vitejs/plugin-react-swc: ^3.10.2 => 3.10.2 
    vite: ^7.0.0 => 7.0.0 
    vitest: ^3.2.4 => 3.2.4

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions