Skip to content

Selecting Internal Config File when Running in Workspace? #6280

Answered by AriPerkkio
amitz asked this question in Q&A
Discussion options

You must be logged in to vote

Something like this should work. Though your repo doesn't have vitest.config.ts for the workspace.

import { readdirSync } from "node:fs";
import { defineProject, defineWorkspace } from 'vitest/config'

const projects = readdirSync("./src");

export default defineWorkspace(
  projects.map((project) => [
    defineProject({
      test: {
        name: `${project} Unit`,
        root: `src/${project}`,
        config: `src/${project}/vitest.config.unit.ts`
      },
    }),
    defineProject({
      test: {
        name: `${project} Integration`,
        root: `src/${project}`,
        config: `src/${project}/vitest.config.integration.ts`
      }, 
    }),
  ]).flat()
)

As the project is curr…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@amitz
Comment options

@AriPerkkio
Comment options

Answer selected by amitz
@amitz
Comment options

@AriPerkkio
Comment options

@amitz
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants