analogjs / analog

The fullstack meta-framework for Angular. Powered by Vite and Nitro
https://analogjs.org
MIT License
2.48k stars 234 forks source link

Documentation for `@analogjs/vitest-angular` is using imports from `@analogjs/vite-plugin-angular` #1136

Closed mattmoos closed 2 months ago

mattmoos commented 2 months ago

Please provide the environment you discovered this bug in.

Docs: https://github.com/analogjs/analog/blob/11577aa08794b547ac0dd504859c2484dd3fd627/packages/vitest-angular/README.md Probably also https://analogjs.org/docs/features/testing/vitest

Which area/package is the issue in?

vitest-angular

Description

While upgrading my (plain Angular) project from @analogjs/vite-plugin-angular to @analogjs/vitest-angular I noticed that the docs for @analogjs/vitest-angular contain

import angular from '@analogjs/vite-plugin-angular';

export default defineConfig(({ mode }) => ({
  plugins: [angular()],

which should probably be

import { vitestBuilder } from '@analogjs/vitest-angular';

export default defineConfig(({ mode }) => {
  return {
    plugins: [vitestBuilder],

I guess that also https://analogjs.org/docs/features/testing/vitest should be migrated to use '@analogjs/vitest-angular', at least for the 'manual installation' section?

Please provide the exception or error you saw

No response

Other information

No response

I would be willing to submit a PR to fix this issue

brandonroberts commented 2 months ago

This is not a bug but setup as intended. vitest-angular is an Angular builder that lets you run the Vitest runner. The @analogjs/vite-plugin-angular package is the plugin that handles Angular compilation.

So you still need both. We do need to update the guide the use vitest-angular:test instead of @analogjs/platform:vitest in the angular.json

mattmoos commented 2 months ago

Oh, this makes so much more sense and I got it to work now. Thank you for the quick answer and sorry for creating a bug.