Skip to content

vitest exclude misses nested node_modules (src/landing) — runs vendored third-party tests #216

@codebanditssss

Description

@codebanditssss

Bug

The renderer vitest config sets a custom exclude that replaces vitest's default **/node_modules/** with a root-anchored node_modules/**, so nested node_modules are no longer excluded. frontend/src/landing is a tracked, self-contained Next.js preview app with its own dependencies, so once its deps are installed, npm test scans src/landing/node_modules/** and runs vendored third-party test suites (zod, next, react-medium-image-zoom, style-to-js).

Analyzed against: 3e64c15 | Confidence: High

Reproduction

cd frontend && npm install
cd src/landing && npm install        # install the landing preview's deps
cd .. && npm test
# → 8 failed test files / 20 failed tests, all under src/landing/node_modules/**
#   (e.g. src/landing/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts)

Root Cause

frontend/vite.renderer.config.ts:

exclude: ["node_modules/**", "dist/**", "dist-electron/**", "e2e/**"],

Providing test.exclude overrides vitest's default (it does not merge). The default is **/node_modules/** (matches at any depth); node_modules/** is root-anchored and misses src/landing/node_modules/**.

Fix

Use **/node_modules/** so nested node_modules (the landing preview's) stay excluded:

exclude: ["**/node_modules/**", "dist/**", "dist-electron/**", "e2e/**"],

Impact

A contributor who runs the landing preview (which the repo supports) and then npm test gets 20+ failures from code that isn't ours, masking real signal. CI is unaffected today (it doesn't install the landing's deps), so this is local-dev friction. Labels: bug, priority: low.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority: lowNice to have, no rush

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions