Skip to content

Replace Jasmine and Karma with Vitest and Vitest Browser #80

@LayZeeDK

Description

@LayZeeDK

Karma is deprecated. We need a test runner with zoneful Angular support.

As our unit tests depend on calculating styles, we need then to run in browsers so we can't use something like Jest with JSDOM. With the @nx/vite plugin including Analog's Angular Vite plugins, Vitest Browser with Playwright browser builds or WebdriverIO-automated browsers is a good candidate

We must also replace the Jasmine + Webpack Server-Side Rendered (SSR) unit tests with a Node.js test runner context. The replacement might be Vitest without Vitest Browser.

Alternatives considered:

  • Web Test Runner: While there is a 3rd party Nx plugin available, Web Test Runner hasn't been published in a stable version yet (0.20.0 is the latest version released at the time of writing) and the Angular CLI Web Test Runner builder has received only a few updates since its first experimental release.
  • Happy DOM: Some tests failed when calling document.adoptNode on browser teardown. There might be some clashing between Happy DOM and Domino, used by Angular SSR.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions