-
Notifications
You must be signed in to change notification settings - Fork 11
Upgrade to Angular 21 #71
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
Conversation
…ngtest - this really is a hack - dumps ng-test compiled files into cache folder, wires them up without caching - without this IDE integration with vitest is not possible with angular's builder - github issue: angular/angular-cli#31734
|
@replete this looks amazing. Let me get caught up a bit and review. As for playwright, I did add an e2e testing section to the README.md that goes over enabling playwright and the eslint config for it. Can you think of project-agnostic configuration above and beyond this to include in either the repo or the README.md for playwright? |
This comment was marked as resolved.
This comment was marked as resolved.
playwright single-framework tradeoffsI have done some investigations and discovered significant tradeoffs with my 'one testing framework' idea: Pros:
Cons:
I think the Angular team would have considered this for sure, though they've not published it. So I'm writing off this idea, though it is still appealing and technically feasible. Others seem to be working on this too, suggesting this idea is not without merits: Hopefully the Vitest IDE integration gets fixed with a vitest plugin or something to unify the testbed with ng-test. ng e2e thoughtsA mature project with proper testing is likely to require Playwright with multiple projects (e2e, integration, smoke, security, a11y, api, perf) - its quite a journey and probably only relevant for some using this project. Chunky deps (inc browsers) - how many people are thinking about e2es when cloning a starter template, and when there are problems do you want to maintain it...
So the playwright schematic did work after I made some changes:
... I'll share a branch in a bit with this for you to look at EDIT: Here's a branch that adds playwright/e2e atop this PR |
|
I was testing out the playwright branch and ran into an issue with Error: Project(s) "e2e-report", "e2e-test-results" not found. Looks like the glob pattern Curious what you think the best approach is here to avoid the collision? Also might be worth adding a note in the README's e2e section about running Let me know what you think! |
|
@joematthews Somehow I completely missed that. Interesting tradeoffs with a starter template, keep it simple with sensible defaults, vs inevitable conventions needed when the project scales. Some of my decisions might be unnecessary for the scope of the project to be honest, e.g. the |
|
I just cloned your template, and found that your vitest workaround doesn't work perfect. Setup: Running test using Running tests using Obviously, the https://medium.com/@italo.masserano/how-to-use-angular-20-experimental-vitest-support-outside-of-ng-test-72447c69a6b7 , which seems to address a similar topic, somehow does call Versions: |
|
The failure seems to be related to Windows as host OS. Your template works fine in |
|
Indeed. In Windows, I have In Windows, the |
|
@karcherm Thanks for the info. I read the angular cli source and can see the issue, it's an angular bug. I have added a workaround, but I do not have Windows therefore I can not test it. If you have Windows, and a devcontainer it would be easiest for you to test this, and fix it if it isn't quite right. Hope that helps. |
|
Thanks for the patch. I didn't test corner cases like repeated filenames, but running |
|
BTW: Did you file a bug on |
|
@karcherm Thanks for the update. |
|
@replete This looks great — thanks for putting in the work on the zoneless migration and wrestling with the Vitest situation. Really appreciate you being upfront about it being a hack. I've got some adjustments on a branch: Fair warning: the diff looks noisy because I reformatted all files after adding Vitest workaround You called it — I went ahead and removed vitest.config.ts and vitest.setup.ts. The Windows issue @karcherm ran into kind of proved the point about fragility. To be clear: we're still using Vitest for testing — tsconfig.json structure Matched the structure from a fresh tsconfig.node.json Added this to catch any root-level Prettier Added Other bits
Goal is keeping extreme-angular as a clean layer on top of |
Fair point. On the other hand, I was researching how to integrate Angular 21 tests with Visual Studio Code, and that's how I found extreme-angular. @replete You might consider putting the vitest workaround into a dedicated package (I guess these files can be dropped by applying a schematic to the project, but I'm talking out of my behind here), because they are useful on its own, even without the other tool integrations provided by extreme-angular. |
|
Hey @replete — didn't want your vitest workaround to just vanish, so I put together a doc based on it: I added a link for it to the testing section of the README.md. Figured that way anyone who wants Test Explorer can still set it up. You're credited at the bottom — hope that's cool! Let me know what you think. |
|
@joematthews No worries, happy to contribute. I could have been clearer about the Vitest hack that I didn't actually expect it to land, was expecting some feedback from you and further changes for the PR but I understand the preference to tidy it up separately for integration. tsconfig: Great. I did intend to check against a newly generated project but it slipped my mind. I did wonder if it would be worth mentioning how to configure isolated relaxed rules. When evaluating component libraries I ended up creating a sandbox folder and a custom tsconfig.sandbox.ts with relaxed rules so I could actually evaluate foreign code in my project without faffing. e.g. what's the DX on adding Material UI and not being able to build the project... haven't tested Material UI but assume it will be similar... |
|
Alright, let's get this merged — you've done the hard work here. I'll follow up with a cleanup PR for the tsconfig/prettier stuff and the vitest workaround doc. The relaxed rules idea for evaluating libraries sounds useful too, could be another good one for ./docs down the road. |

Hi Joe, hope you are well.
Picking up a new Angular project and noticed Angular 21 just came out, decided to try updating to 21.
Obviously no pressure to land this - I wanted to check out the new features.
rules: {}to config)peer:truechange ...shakes fist at dependabotCommits build on each other, may want to avoid Karma-Vitest migration for now given the hack I had to write to make IDE integration work. I like how fast the unit tests run though, and without a Chrome dependency. Spent a lot of time this year with Playwright, but felt like too much for this so I didn't add that though I probably will in my project.
Cheers,
Phil