Skip to content

excludes are not working #673

@wmertens

Description

@wmertens

Describe the bug

In the https://github.com/QwikDev/qwik monorepo, I configured vitest as follows:

import { qwikVite } from '@qwik.dev/core/optimizer';
import tsconfigPaths from 'vite-tsconfig-paths';
import { defineConfig } from 'vitest/config';

export default defineConfig({
  plugins: [
    qwikVite({
      debug: !true,
      srcDir: `./packages/qwik/src`,
    }),
    tsconfigPaths({ ignoreConfigErrors: true }),
  ],
  test: {
    root: 'packages',
    include: [
      '**/*.spec.?(c|m)[jt]s?(x)',
      '**/*.unit.?(c|m)[jt]s?(x)',
      '!*/(lib|dist|build|server|target)/**',
      '!**/node_modules/**',
    ],
    setupFiles: ['../vitest-setup.ts'],
    projects: ['..'],
  },
});

and when I test this by adding a unit test file under an excluded path (like packages/docs/server/testing.unit.ts), and running vitest list --files-only, then it works, the excluded file isn't shown.

However, when I look at the vitest extension output, and I touch a file under an excluded path, it will output that the file was changed, not that it was ignored.

This is a problem when some build steps are creating thousands of files and the vitest extension seems to scan and process all of them, even when watch mode is off and no tests are running.

Reproduction

have the extension in vscode

at the end of the build it will be writing to packages/docs/server which is excluded, but the vitest extension will start to process all of it and use lots of resources.

Please note, this is not a minimial repro because it would take some time to do and I am thinking that perhaps you can already know where the problem is without the repro. If the minimal repro is still needed I will make it.

Output

there is no error besides out of memory and things like changed file: packages/docs/server/...

Here is what happens when I touch packages/docs/server/testing.unit.ts:

INFO 11:10:08 AM] [API] Resolving configs: qwik/vitest.config.mts, qwik-react/vite.config.mts, qwik-cli-e2e/vite.config.mts, adapters-e2e/vite.config.ts, qwik-react-e2e/vite.config.ts, insights/vitest.config.mts, docs/vite.config-repl-sw.ts, docs/vite.config.ts, supabase-auth-helpers-qwik/vite.config.mts, qwik-router/vite.config.mts, csr/vite.config.mts, perf.prod/vite.config.mts, preloader-test/vite.config.ts, library/vite.config.mts, base/vite.config.mts, express/vite.config.ts, express/vite.config.ts, netlify-edge/vite.config.ts, cloudflare-pages/vite.config.ts, web-worker/vite.config.mts, supabase-auth-helpers-qwik/vite.config.d.mts, qwik-router/vite.config.d.mts, qwik-router/vite.config.mjs, supabase-auth-helpers-qwik/vite.config.mjs, deno/vite.config.mts, vercel-edge/vite.config.mts, ssg/vite.config.mts, bun/vite.config.mts, express/vite.config.mts, cloud-run/vite.config.mts, node-server/vite.config.mts, cloudflare-pages/vite.config.mts, azure-swa/vite.config.mts, firebase/vite.config.mts, fastify/vite.config.mts, aws-lambda/vite.config.mts, netlify-edge/vite.config.mts, library/vite.config.mts, base/vite.config.mts, csr/vite.config.mts, web-worker/vite.config.d.mts, web-worker/vite.config.mjs, bun/vite.config.mts, cloudflare-pages/vite.config.mts, ssg/vite.config.mts, azure-swa/vite.config.mts, vercel-edge/vite.config.mts, firebase/vite.config.mts, aws-lambda/vite.config.mts, deno/vite.config.mts, node-server/vite.config.mts, cloud-run/vite.config.mts, express/vite.config.mts, netlify-edge/vite.config.mts, fastify/vite.config.mts
[INFO 11:10:08 AM] [API] Running Vitest v3.2.4 (qwik/vitest.config.mts) with "/nix/store/cwxxy2is6hb4dcqsx8rhnvwic3hfzpcd-nodejs-22.19.0/bin/node /home/wmertens/.vscode/extensions/vitest.explorer-1.32.0/dist/worker.js"
[INFO 11:10:09 AM] [API] Ignoring config qwik-react/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config qwik-cli-e2e/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config adapters-e2e/vite.config.ts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config qwik-react-e2e/vite.config.ts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config insights/vitest.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config docs/vite.config-repl-sw.ts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config docs/vite.config.ts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config supabase-auth-helpers-qwik/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config qwik-router/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config csr/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config perf.prod/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config preloader-test/vite.config.ts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config library/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config base/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config express/vite.config.ts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config express/vite.config.ts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config netlify-edge/vite.config.ts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config cloudflare-pages/vite.config.ts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config web-worker/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config supabase-auth-helpers-qwik/vite.config.d.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config qwik-router/vite.config.d.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config qwik-router/vite.config.mjs because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config supabase-auth-helpers-qwik/vite.config.mjs because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config deno/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config vercel-edge/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config ssg/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config bun/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config express/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config cloud-run/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config node-server/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config cloudflare-pages/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config azure-swa/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config firebase/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config fastify/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config aws-lambda/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config netlify-edge/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config library/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config base/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config csr/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config web-worker/vite.config.d.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config web-worker/vite.config.mjs because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config bun/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config cloudflare-pages/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config ssg/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config azure-swa/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config vercel-edge/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config firebase/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config aws-lambda/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config deno/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config node-server/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config cloud-run/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config express/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config netlify-edge/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Ignoring config fastify/vite.config.mts because there is a workspace config in the parent folder
[INFO 11:10:09 AM] [API] Watching vitest.config.mts
[INFO 11:10:09 AM] [VSCODE] Watching qwik with pattern **/*
[11:12:19 AM] [VSCODE] File created: packages/docs/server/testing.unit.ts
[INFO 11:12:19 AM] [Worker] Collecting tests due to file changes: docs/server/testing.unit.ts
Collecting using AST explorer...
[INFO 11:12:19 AM] [Worker] Collecting docs/server/testing.unit.ts 
[Error 11:12:19 AM] Cannot find a file test item for /home/wmertens/Projects/qwik/packages/docs/server/testing.unit.ts in "core" project.

Extension Version

1.32.0

Vitest Version

3.2.4

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions