vitest-dev / vitest

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

Should `vi.setConfig({ sequence: { concurrent: true } })` work? #6684

Open hi-ogawa opened 2 weeks ago

hi-ogawa commented 2 weeks ago

Describe the bug

Docs now mentions it's not supported https://vitest.dev/api/vi.html#vi-setconfig But it's available as typing of vi.setConfig. https://github.com/vitest-dev/vitest/blob/2a50464d58e98f58fed513971a570a952081bfef/docs/api/vi.md?plain=1#L977-L980

But it might be a regression and possible to make it work again https://github.com/vitest-dev/vitest/pull/6653#issuecomment-2403730192

If not, we should update RuntimeConfig to hide it from typing.

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-opxrtz?file=repro.test.ts

(based on tests from https://github.com/vitest-dev/vitest/issues/6652)

System Info

(stackblitz)

  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @vitest/ui: 2.1.2 => 2.1.2 
    vite: latest => 5.4.8 
    vitest: 2.1.2 => 2.1.2

Used Package Manager

npm

Validations

sheremet-va commented 1 week ago

Conceptually, I don't see why it wouldn't work:

vi.setConfig({ sequence: { concurrent: true } })
describe('suite1') // concurrent
describe('suite2') // concurrent
describe('suite3', { concurrent: false }) // sequential

The question is here, I guess:

describe('suite1', () => {
  vi.setConfig({ sequence: { concurrent: true } })
  describe('suite2') // should it inherit parent suite options or follow global config?
})