From 85ad3b0d545efce9f5f6fa8afb8f8d07457bd9ef Mon Sep 17 00:00:00 2001 From: Liam McAteer <=> Date: Wed, 26 Apr 2023 14:38:28 -0500 Subject: [PATCH] feat(vite): add `--testFile` argument to @nrwl/vite:test closed #16280 --- docs/generated/packages/vite/executors/test.json | 4 ++++ packages/vite/src/executors/test/schema.d.ts | 1 + packages/vite/src/executors/test/schema.json | 4 ++++ packages/vite/src/executors/test/vitest.impl.ts | 3 ++- 4 files changed, 11 insertions(+), 1 deletion(-) 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;