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

Feature: Introduce a standalone package for Vitest + Angular support #993

Closed
2 tasks
brandonroberts opened this issue Apr 2, 2024 · 7 comments · Fixed by #1105
Closed
2 tasks

Feature: Introduce a standalone package for Vitest + Angular support #993

brandonroberts opened this issue Apr 2, 2024 · 7 comments · Fixed by #1105
Labels
enhancement New feature or request

Comments

@brandonroberts
Copy link
Member

Which scope/s are relevant/related to the feature request?

Don't know / other

Information

This would be a standalone package for Vitest and Angular with minimal external dependencies. We currently have the Vitest integration installed with @analogjs/platform and a schematic/generator for the initial setup. This would add a @analogjs/vitest-angular package to the repository which consists of:

  • Support for ng add as a standalone package
  • A dependency on the @analogjs/vite-plugin-angular package
  • A schematic for adding Vitest to a project manually without a hard dependency on Nx
  • A builder for running unit tests with Vitest without a hard dependency on Nx

Other considerations

  • Nx would still be supported in both scenarios, just not as a hard dependency
  • Potentially migrating existing usage of @analogjs/platform:vitest to the new standalone builder

Describe any alternatives/workarounds you're currently using

No response

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

  • Yes
  • No
@brandonroberts brandonroberts added the enhancement New feature or request label Apr 2, 2024
@brandonroberts
Copy link
Member Author

cc: @yjaaidi @rainerhahnekamp

@rainerhahnekamp
Copy link

Yes, absolutely. That is the number one question: "Do I have to install the complete Analog framework for Vitest?". Having a standalone package makes it much clearer.

@brandonroberts
Copy link
Member Author

The @analogjs/vitest-angular package has been released as part of Analog 1.4.0. It's a fully standalone Angular builder with no external dependencies.

Installation instructions https://www.npmjs.com/package/@analogjs/vitest-angular

Feedback is welcomed!

@rainerhahnekamp
Copy link

Thanks Brandon, will give it a try asap

@NateRadebaugh
Copy link
Contributor

Works great, thanks!

One piece of feedback: it feels kind of odd importing from @analogjs/vite-plugin-angular since that's no longer an explicit dependency. I'm wondering if it would "feel better" to import the vite plugin from @analogjs/vitest-angular

@brandonroberts
Copy link
Member Author

Works great, thanks!

One piece of feedback: it feels kind of odd importing from @analogjs/vite-plugin-angular since that's no longer an explicit dependency. I'm wondering if it would "feel better" to import the vite plugin from @analogjs/vitest-angular

Interesting. It's not an explicit dependency in that you are not required to use @analogjs/vite-plugin-angular. For example, @yjaaidi has a plugin also that they could use with the Vitest builder.

The plugin and the builder are still two separate packages because the plugin can be used in other environments.

@NateRadebaugh
Copy link
Contributor

The plugin and the builder are still two separate packages because the plugin can be used in other environments.

Thanks yes I understand that. What I meant is that sometimes libraries will re-export its contents for a more ergonomic/abstracted API. Either way works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants