-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Build: Run unit tests on more node versions, mac, and windows #16744
Conversation
Nx Cloud ReportCI ran the following commands for commit dacc755. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch
Sent with 💌 from NxCloud. |
Nx Cloud ReportWe didn't find any information for the current pull request with the commit 2548872. Check the Nx Cloud Github Integration documentation for more information. Sent with 💌 from NxCloud. |
As expected, Windows tests are failing. I'm not sure how we'd even get them passing, TBH. Interestingly, Node 17 is also failing, due to something in webpack 5, it seems:
Ah, yes this Node 17 problem has been raised in an issue: #16555 |
One approach might be to use https://www.npmjs.com/package/jest-os-detection to write linux and windows specific tests that only run on particular operating systems. But, I'd like to know if the team thinks this is worth exploring, before I put any time into it. Also, if anyone else already has a good windows environment set up, I'd be happy to turn this effort over to them. :) |
@ndelangen exactly. Line endings and path separator differences ( |
b63347d
to
2412607
Compare
OK, it'll take a while for the CI to run, but I think I've at least gotten the snapshots passing on both windows and linux. I'll take a look at the unit tests next. |
032a0db
to
1faf93d
Compare
@ndelangen is it possible that this is a legit failure on windows?
|
That doesn't look good indeed. @IanVS |
I have taken a look at the Angular tests on Windows and usually end up just running the specific tests that I know my change could affect and just let the rest run in CI, or a linux VM if I am fairly sure I will need to rerun the tests multiple times. It would be nice to not have to do that. I am not the most experienced with unit tests, but I can try to help get the Angular ones passing, at least. One tricky thing I have run into with tests on Windows is the different valid path formats, depending on what will be processing them. I was trying to fix one last night and I think it was a Typescript Webpack plugin had a path in the format |
Well, I took a look at the Angular errors, again and even though I would like it to be more obvious which path formatting should be used, they weren't as far off from fixing as I remembered from last time I looked. I haven't tested them outside of windows yet, but I can do that then submit them or you can just pick them out of my fork if it's useful. It isn't much: Marklb@e432ea0 |
8a5b383
to
1dad0ee
Compare
OK, I've made some updates and verified that the unit test matrix jobs do not run on a PR unless the |
OK, with the latest commit I've made sure the tests continue to run when new commits are pushed as long as that label still is present. |
// this only applies to this file | ||
jest.setTimeout(10000); | ||
|
||
// FIXME: this doesn't work |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments on this FIXME, @IanVS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found that the stories.json
file was still being created. Also, when I turned on logging, I was seeing messages about this preset being invalid. I think maybe it's not in the correct format for a preset, perhaps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this very thoughtful PR, @IanVS. Future contributors on Windows should have a much nicer experience.
These changes look good to me, but people more familiar with Windows dev and/or @shilman, @ndelangen, @tmeasday should provide final approval.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IanVS This is amazing work. Thanks so much for putting the time in, and also for your patience on the merge. I'm guessing we'll need to tweak a bit once we run this in practice, but I'll coordinate that with you when the time comes. In the meantime, merging! 💯
Thanks @shilman. And just to close the loop on one point, it does look like the unit tests are running against the next branch, as intended: |
I think running the unit tests on multiple platforms is great, but taking different snapshot on different platforms, will make things more difficult. If someone needs to update the snapshots, they need access to both platforms, which is not something everyone has (me included, I do not have access to any windows platform device) |
That's a good point. I was using a virtual machine on my mac when I was working on this PR, but that's a pain. I could see a few different possible solutions.
I'd love if we could find an option that's not #4, since I think it's good to have visibility into the windows experience. But, I'll understand if that's the way y'all want to go. |
I'm not necessarily advocating for this but with Circle it is possible to create downloadable artifacts from a build. What we did in a similar situation in the Chromatic monorepo is do the snapshot tests in CI in two phases:
It's a bit clunky but it does mean as a dev you can download the snapshots generated in CI in 2. |
Issue: N/A
What I did
In #16723 (review), it was requested to run tests on Windows. It surprised me a bit that unit tests were not already automatically running on windows for every PR. So, this PR adds windows to the unit tests in the github action. I also took things a step further and added more versions of node.js, as well as MacOS.
According to #16664, we can expect the windows tests to fail. And I'm not sure if there's been discussion previously on adding windows tests or not, but I figured I'd throw this up and see what happens. :)
How to test
If your answer is yes to any of these, please make sure to include it in your PR.