Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(vitest-angular): add UI and coverage options to test #1521

Merged
merged 2 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/vitest-angular/src/lib/builders/test/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ export interface VitestSchema {
reportsDirectory?: string;
testFiles?: string[];
watch?: boolean;
ui?: boolean;
coverage?: boolean;
}
8 changes: 8 additions & 0 deletions packages/vitest-angular/src/lib/builders/test/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
"watch": {
"description": "Watch files for changes and rerun tests related to changed files.",
"type": "boolean"
},
"ui": {
"description": "Run tests using Vitest UI Mode.",
"type": "boolean"
},
"coverage": {
"description": "Enable code coverage analysis.",
"type": "boolean"
}
},
"required": []
Expand Down
9 changes: 8 additions & 1 deletion packages/vitest-angular/src/lib/builders/test/vitest.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,19 @@ async function vitestBuilder(
const projectConfig = await context.getProjectMetadata(
context.target as unknown as string
);
const extraArgs = await getExtraArgs(options);
const { coverageArgs, ...extraArgs } = await getExtraArgs(options);
const watch = options.watch === true;
const ui = options.ui === true;
const coverageEnabled = options.coverage === true;
const config = {
root: `${projectConfig['root'] || '.'}`,
watch,
ui,
config: options.configFile,
coverage: {
enabled: coverageEnabled,
...coverageArgs,
},
...extraArgs,
};

Expand Down
Loading