38 lines
781 B
TypeScript
38 lines
781 B
TypeScript
import { defineConfig } from 'vitest/config'
|
|
import tsconfigPaths from 'vite-tsconfig-paths'
|
|
import fs from 'node:fs'
|
|
import path from 'node:path'
|
|
|
|
const packagesDir = path.resolve(__dirname, 'packages')
|
|
const projects = [path.resolve(__dirname, 'tsconfig.json')]
|
|
|
|
if (fs.existsSync(packagesDir)) {
|
|
const packages = fs.readdirSync(packagesDir)
|
|
for (const pkg of packages) {
|
|
const tsconfigPath = path.join(packagesDir, pkg, 'tsconfig.json')
|
|
if (fs.existsSync(tsconfigPath)) {
|
|
projects.push(tsconfigPath)
|
|
}
|
|
}
|
|
}
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
projects: [
|
|
'./packages/*',
|
|
{
|
|
extends: true,
|
|
envDir: "./"
|
|
}
|
|
]
|
|
},
|
|
plugins: [
|
|
tsconfigPaths({
|
|
root: "./",
|
|
projects
|
|
})
|
|
],
|
|
resolve: {
|
|
}
|
|
})
|