vitest-dev / vitest

Next generation testing framework powered by Vite.
https://vitest.dev
MIT License
12.68k stars 1.14k forks source link

Isolate option doesn't work when run in workspace mode #6258

Open paulintrognon opened 1 month ago

paulintrognon commented 1 month ago

Describe the bug

I have 2 projects in my workspace, one in isolate mode and not the other, but it appears that both are isolated, as if the isolate option was not supported in workspaces. I guess it's as intended and an * is missing from the docs (like https://github.com/vitest-dev/vitest/issues/5933)

Reproduction

import { defineWorkspace } from 'vitest/config'

export default defineWorkspace([
  {
    extends: './vitest.e2e-config.ts',
    test: {
      name: 'e2e-isolated',
      include: ['**/*.e2e-spec.isolated.ts'],
      isolate: true,
    },
  },
  {
    extends: './vitest.e2e-config.ts',
    test: {
      name: 'e2e-shared',
      include: ['**/*.e2e-spec.ts'],
      isolate: false, // Does not work, tests are still isolated
    },
  },
])

System Info

System:
    OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa)
    CPU: (12) x64 Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz
    Memory: 17.76 GB / 30.95 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 20.15.1 - ~/.nvm/versions/node/v20.15.1/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v20.15.1/bin/yarn
    npm: 10.7.0 - ~/.nvm/versions/node/v20.15.1/bin/npm
    Watchman: 20210821.022905.0 - /usr/local/bin/watchman
  Browsers:
    Chrome: 127.0.6533.72
    Chromium: 126.0.6478.182
  npmPackages:
    @vitest/coverage-v8: 2.0.3 => 2.0.3 
    vitest: 2.0.3 => 2.0.3

Used Package Manager

yarn

Validations

AriPerkkio commented 1 month ago

What do you mean by not working? How is not working? What's expected and actual outputs?

Per https://github.com/vitest-dev/vitest/issues/4731#issuecomment-1853405133 isolate on project level should not affect root/pool level isolation, meaning that a single thread/process won't be re-used for such projects.

Though this PR seems to change that: https://github.com/vitest-dev/vitest/pull/5791

paulintrognon commented 3 weeks ago

Indeed the PR seems to fix just that, thanks for pointing it out! I will close this issue when the PR's merged