-
Notifications
You must be signed in to change notification settings - Fork 12
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
tests: use tmp-dir for several command tests #836
Conversation
543db98
to
2eebbf5
Compare
Hey @doc-han , sorry I'm not sure I understand this one. Either I've missed or forgotten something or we've gotten a little lost in the woods. The problem as I understand it is that in node 20, But since the test adaptors are all on disk anyway, surely we can just bypass the mock and load them "naturally"? I don't really understand why we're copying files already on disk to a temporary directory, and I don't understand why we're writing job files to disk when the mock layer should still work. So the only change should be that mock-fs doesn't mock out the repo or modules or any other dir that gets imported. So we mock inputs to the CLI but the module loader uses the real file system. Is the issue more subtle than that? Like if we use mock-fs at all then I also think this branch should be targeted at your node 20 branch, because the node 20 behaviour is more important than the node 18 behaviour. Although I do appreciate that this proves the tests work after the refactor! |
Exactly. So So for a given test, it's either you go fully real or virtual.
|
@doc-han isn't there a thing in mock-fs where you can ignore some paths and just let it access the filesystem? I'm sure we do that somewhere |
Right: But I take it that still breaks |
It doesn't seem to work. |
Yeah it breaks |
Alright, thank you for the clarification. Sorry to be a pain about this, and I totally understand the reasoning, but i just really don't like the solution 🤔 At least it's isolated to one test file. What about we move the problematic tests into integration tests, which can use the filesystem in a more predictable way? They're all related to adaptor loading and deep runtime importing. They're actually hardly CLI tests at all - from a CLI point of view we just need to pass the right arguments into the runtime. I don't think we'd even need to move every test - just look at the interesting ones. Some of them just test command line aliases ( |
Yeah we can do that. |
@doc-han awesome, thank you. Take a look - if you're not sure about what to move, a temporary solution is to .skip the offending tests and I'll move them next week. |
I'll like to deal with them. How about moving just the offending test first (so that the node update branch can be progressed). |
@doc-han sure - that sounds great. I'm all for fixing stuff nicely, just worried it's too boring for you! Let's move the tests here. Anything ambiguous or difficult you can just flag to me and we'll work out what to do |
Ok, this is getting too expensive. I'll do a final review ASAP and merge this as-is. Thanks! Update: this is already in the base branch. Let's close this and keep it over there. |
Short Description
Updates our problematic command tests to use the tmp dir instead of a mocked filesystem(mock-fs)
Fixes #834
Implementation Details
__modules__
,__repo__
&__monorepo__
once because all test don't seem to write there. Just reads!job.js
during a testQA Notes
AI Usage
Please disclose how you've used AI in this work (it's cool, we just want to know!):
You can read more details in our Responsible AI Policy