Skip to content

Angular 14 support #296

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

Closed
jadengis opened this issue Jun 7, 2022 · 6 comments · Fixed by #297
Closed

Angular 14 support #296

jadengis opened this issue Jun 7, 2022 · 6 comments · Fixed by #297
Labels

Comments

@jadengis
Copy link
Contributor

jadengis commented Jun 7, 2022

Description

Currently standalone components, directives and pipes cannot be tested because they are automatically added to the declarations portion when configuring TestBed internally. Angular throws an error when trying to declare a standalone component.

Proposed solution

Add the component/directive/pipe-under-test to the imports section of TestBed.configureTestingModule if the component is standalone.

Alternatives considered

There isn't really a way to work around this.

@rothsandro
Copy link
Contributor

I did not test it but maybe it helps to set excludeComponentDeclaration: true.

@timdeschryver
Copy link
Member

Hi, sadly I didn't have the bandwidth to proactively test ATL with standalone components.
I do think that excludeComponentDeclaration should work.
Maybe we can improve the API for standalone components later.

@jadengis
Copy link
Contributor Author

jadengis commented Jun 7, 2022

Do you accept PRs? There is an isStandalone function that can be used to put the component in imports instead of declarations when it's a standalone component.

@jadengis
Copy link
Contributor Author

jadengis commented Jun 8, 2022

I opened a PR which upgrades to v14 and fixes the render api to add standalone components to imports instead of declarations. With this change await render(StandaloneComponent) works. Let me know what you think. 🙏

@timdeschryver
Copy link
Member

Great, thanks @jadengis (of course PRs are more than welcome, thanks for that!).
I left a comment in the PR.

@github-actions
Copy link

github-actions bot commented Jun 9, 2022

🎉 This issue has been resolved in version 12.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants