Skip to content
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
4 changes: 2 additions & 2 deletions modules/testing/builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"@angular-devkit/architect": "workspace:*",
"@angular/ssr": "workspace:*",
"@angular-devkit/build-angular": "workspace:*",
"@vitest/coverage-v8": "4.0.0",
"@vitest/coverage-v8": "4.0.6",
"jsdom": "27.0.1",
"rxjs": "7.8.2",
"vitest": "4.0.0"
"vitest": "4.0.6"
}
}
4 changes: 2 additions & 2 deletions packages/angular/build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"ng-packagr": "21.0.0-rc.0",
"postcss": "8.5.6",
"rxjs": "7.8.2",
"vitest": "4.0.0"
"vitest": "4.0.6"
},
"peerDependencies": {
"@angular/core": "0.0.0-ANGULAR-FW-PEER-DEP",
Expand All @@ -74,7 +74,7 @@
"tailwindcss": "^2.0.0 || ^3.0.0 || ^4.0.0",
"tslib": "^2.3.0",
"typescript": ">=5.9 <6.0",
"vitest": "^4.0.0"
"vitest": "^4.0.6"
},
"peerDependenciesMeta": {
"@angular/core": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ export class VitestExecutor implements TestExecutor {
} = this.options;

let vitestNodeModule;
let vitestCoverageModule;
try {
vitestCoverageModule = await import('vitest/coverage');
vitestNodeModule = await import('vitest/node');
} catch (error: unknown) {
assertIsError(error);
Expand All @@ -158,21 +156,6 @@ export class VitestExecutor implements TestExecutor {
}
const { startVitest } = vitestNodeModule;

// Augment BaseCoverageProvider to include logic to support the built virtual files.
// Temporary workaround to avoid the direct filesystem checks in the base provider that
// were introduced in v4. Also ensures that all built virtual files are available.
const builtVirtualFiles = this.buildResultFiles;
vitestCoverageModule.BaseCoverageProvider.prototype.isIncluded = function (filename) {
const relativeFilename = path.relative(workspaceRoot, filename);
if (!this.options.include || builtVirtualFiles.has(relativeFilename)) {
return !isMatch(relativeFilename, this.options.exclude);
} else {
return isMatch(relativeFilename, this.options.include, {
ignore: this.options.exclude,
});
}
};

// Setup vitest browser options if configured
const browserOptions = await setupBrowserConfiguration(
browsers,
Expand Down
109 changes: 54 additions & 55 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/legacy-cli/e2e/utils/vitest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { updateJsonFile } from './project';

/** Updates the `test` builder in the current workspace to use Vitest. */
export async function applyVitestBuilder(): Promise<void> {
await silentNpm('install', 'vitest@4.0.0', 'jsdom@27.0.0', '--save-dev');
await silentNpm('install', 'vitest@4.0.6', 'jsdom@27.0.0', '--save-dev');

await updateJsonFile('angular.json', (json) => {
const projects = Object.values(json['projects']);
Expand Down