sourcegraph/vitest.workspace.ts
Felix Kling 9b9bd4387c
vitest: Fix workspace config wrt client/web/ (#58397)
It appears that the workspace configuration is somehow broken because it
doesn't include any tests defined in `client/web/src/`. This can be
tested by filtering for a test inside this subtree, for example

    pnpm exec vitest RepoRevisionSidebar

vitest will error saying it didn't find any tests. The list of projects
it prints also doesn't include `web`.

I don't know what exactly it is that makes it exclude `client/web/` but
with the simpler version in this PR `client/web/` will be included.

I removed `client/web/dev/` from the list because it will be included by
`client/web/` too and seems to "just work" even though it has it's own
configuration file.
2023-11-17 08:22:46 +00:00

17 lines
440 B
TypeScript

import { readFileSync } from 'fs'
import path from 'path'
import { load } from 'js-yaml'
interface PnpmWorkspaceFile {
packages: string[]
}
function fromPnpmWorkspaceFile(filePath: string): string[] {
return (load(readFileSync(filePath, 'utf8')) as PnpmWorkspaceFile).packages.map(p => `${p}/vitest.config.ts`, {
cwd: __dirname,
})
}
export default fromPnpmWorkspaceFile(path.join(__dirname, 'pnpm-workspace.yaml'))