Skip to content

Commit

Permalink
feat(vite): add --testFile argument to @nrwl/vite:test
Browse files Browse the repository at this point in the history
closed #16280
  • Loading branch information
Liam McAteer authored and mandarini committed Apr 26, 2023
1 parent 2d78de5 commit 85ad3b0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/generated/packages/vite/executors/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down
1 change: 1 addition & 0 deletions packages/vite/src/executors/test/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export interface VitestExecutorOptions {
update?: boolean;
reportsDirectory?: string;
coverage?: boolean;
testFile?: string;
}
4 changes: 4 additions & 0 deletions packages/vite/src/executors/test/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down
3 changes: 2 additions & 1 deletion packages/vite/src/executors/test/vitest.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 85ad3b0

Please sign in to comment.