I am aiming to run different vite configs against the same set of tests to verify that different plugin implementations result in the same css transforms (namely a postcss-plugin and a vite-plugin). I have the following vitest.workspace.ts:
import { defineConfig, mergeConfig } from 'vite';
import { defineWorkspace } from 'vitest/config';
import postcssPlugin from './dist/postcss';
import vitePlugin from './dist/vite';
const base = defineConfig({
root: 'test',
build: {
write: false,
ssr: true
},
test: {
css: true,
root: 'test'
}
});
export default defineWorkspace([
mergeConfig(base, {
plugins: [vitePlugin()],
test: {
name: 'vite-plugin'
}
}),
mergeConfig(base, {
css: {
postcss: { plugins: [postcssPlugin()] }
},
test: {
name: 'postcss-plugin'
}
})
]);
If I plan to use vite's build() inside a vitest beforeAll hook, how can I make sure build uses each workspace's respective config?