vitest-dev / vitest

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

Allow inline workspace #6913

Closed sheremet-va closed 3 days ago

sheremet-va commented 1 week ago

Clear and concise description of the problem

It would be nice to support inline workspace configuration:

export default defineConfig({
  test: {
    workspace: [
      {
        test: { 
          name: 'node', 
          environment: 'node'
        }, 
      },
      {
        test: { 
          name: 'jsdom', 
          environment: 'jsdom'
        }, 
      }
    ]
  }
})

This feature is required for https://github.com/vitest-dev/vitest/issues/6912 to make the migration easier.

Suggested solution

Alllow inlined workspace in the main config.

Alternative

No response

Additional context

Some questions:

  1. Should inline workspace override the workspace file? Or should they be merged instead?
  2. Is there a way to reduce the nesting?

Validations