Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[@angular/build:unit-test][vitest] Configurable vitest #30429

@joergbaier

Description

Command

test

Description

First of all, I support the initiative to add vitest to Angular. Especially since vite is already used for (削除) build & (削除ここまで) serve.

Early feedback for vitest in Angular v20. Based on a quick browse of packages/angular/build/src/builders/unit-test/builder.ts there doesn't seem to be a way to pass configuration settings.

For this to be even slightly usable, you would need to set vitest options such as:

  • timeouts
  • setupFiles
  • coverage (specify lcov reporter)

Describe the solution you'd like

One option is letting people pass vitest options in angular.json and doing a deep object merge. This is probably the easiest to implement but most likely to lead to configuration confusion and conflicts.

Describe alternatives you've considered

Personally I would rather see less obfuscation... let people have a vitest.config.ts. Projects that don't have advanced testing needs would never need to add this file.

import { defineConfig } from "vitest/config";
export default defineConfig({
 test: {}
});

With the vitest.config.ts, Angular could add a plugin similar to @analogjs/vite-plugin-angular.

OR

Export an Angular version of defineConfig which is used instead of vitest/config. Then you can strongly type the options and include/exclude ones that make sense for angular.

import { defineConfig } from "@angular/vitest";
export default defineConfig({ ... });

Please press the 👍 since this needs at least 20 to be considered!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /