Skip to content

Startup errors are hidden behind 'No test files found' and a charCodeAt crash (Vitest 5.0.5 + Vite 8.3.5) #611

Open

Description

@danfry1

With the repository's pinned Vitest 5.0.5 and Vite 8.3.5, an error thrown at startup (for example in a globalSetup) is reported as No test files found, even when test files exist. It's followed by a crash while the error is printed, so the real error never appears:

No test files found, exiting with code 1
⎯⎯⎯⎯⎯⎯⎯ Startup Error ⎯⎯⎯⎯⎯⎯⎯⎯
TypeError: code.charCodeAt is not a function
    at extractInlineSourceMap (vite/dist/node/module-runner.js)
    at EvaluatedModules.getModuleSourceMapById

This is a Vitest bug, not ours. It reproduces without vitest-native, in an empty directory:

// vitest.config.mjs
export default { test: { include: ["*.check.js"], globalSetup: ["./gs.mjs"] } };
// gs.mjs
export function setup() { throw new Error("boom from global setup"); }
// a.check.js
test("x", () => {});

Running vitest run prints the output above, and "boom from global setup" is never shown.

Cause: vitest-dev/vitest#11682. Vitest's server module runner read cached modules as a Buffer, and Vite 8.3.5 calls code.charCodeAt on them. It's fixed by vitest-dev/vitest#11709, which shipped in Vitest 5.1.0 (published 2026-11-02).

Here: the native suite's dispatch-fixtures race produced exactly this (fixed separately in #610), and the crash is what made it hard to diagnose.

To do: bump the pinned Vitest to 5.1.0. The repository's 7-day minimum release age allows it from 2026-11-09, and the version change needs approval like any dependency change. Then confirm that the reproduction above prints the global setup's error.

Activity

  1. added this to the 0.16.0 milestone on Nov 6, 2026
  2. added
    bug
    priority:low
    on Nov 6, 2026
  3. danfry1 commented on Nov 6, 2026

    @danfry1
    OwnerAuthor

    Approved: bump the pinned Vitest (and matching @vitest/* packages) from 5.0.5 to 5.1.0 on or after 2026-11-09 16:13 UTC, when the 7-day release-age gate allows it. Under the upstream policy proposal (#613), 5.1.0 becomes the recommended floor for Vitest 5: a startup warning and a doctor entry naming vitest-dev/vitest#11682. The hard floor stays 5.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority:low

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions