diff --git a/docs/generated/packages/vite/executors/test.json b/docs/generated/packages/vite/executors/test.json index 95029c4a29ce6..185e99fd94b79 100644 --- a/docs/generated/packages/vite/executors/test.json +++ b/docs/generated/packages/vite/executors/test.json @@ -57,6 +57,10 @@ "reportsDirectory": { "type": "string", "description": "Directory to write coverage report to." + }, + "testFile": { + "description": "The name of the file to test.", + "type": "string" } }, "required": [], diff --git a/packages/vite/src/executors/test/schema.d.ts b/packages/vite/src/executors/test/schema.d.ts index c6eb7ff35caee..4102b5292cd57 100644 --- a/packages/vite/src/executors/test/schema.d.ts +++ b/packages/vite/src/executors/test/schema.d.ts @@ -8,4 +8,5 @@ export interface VitestExecutorOptions { update?: boolean; reportsDirectory?: string; coverage?: boolean; + testFile?: string; } diff --git a/packages/vite/src/executors/test/schema.json b/packages/vite/src/executors/test/schema.json index fcd86fec9713d..fa9fa8608375f 100644 --- a/packages/vite/src/executors/test/schema.json +++ b/packages/vite/src/executors/test/schema.json @@ -56,6 +56,10 @@ "reportsDirectory": { "type": "string", "description": "Directory to write coverage report to." + }, + "testFile": { + "description": "The name of the file to test.", + "type": "string" } }, "required": [], diff --git a/packages/vite/src/executors/test/vitest.impl.ts b/packages/vite/src/executors/test/vitest.impl.ts index 5af2472dbb383..479832b11b205 100644 --- a/packages/vite/src/executors/test/vitest.impl.ts +++ b/packages/vite/src/executors/test/vitest.impl.ts @@ -56,8 +56,9 @@ export async function* vitestExecutor( const nxReporter = new NxReporter(options.watch); const settings = await getSettings(options, context); settings.reporters.push(nxReporter); + const cliFilters = options.testFile ? [options.testFile] : []; - const ctx = await startVitest(options.mode, [], settings); + const ctx = await startVitest(options.mode, cliFilters, settings); let hasErrors = false;