-
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
Add unit test to mainAsync #151
Conversation
Seems like the tests fail; you're mocking the FS but also using the FS. |
Fixed. I didn't occur to me to run the rest of the tests, I think it will work now. |
Seems like I was wrong. |
// @ts-ignore | ||
Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose"); |
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.
What version of node are you on? This should be present.
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.
v20.12.1
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.
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.
Locally, I assume it would crash on CI but I can give it a try without it
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.
Wow, it does fail. That doesn't make any sense at all...
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.
It fails on CI as well
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.
Oh, this is because jest makes an entirely different environment that's missing these, even though the system has it: jestjs/jest#14874
I guess we can leave it in, though we could probably also just swap jest out for vitest.
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 put it back then. We can track migrating to vitest on issue #153
Adds a simple unit test for the
mainAsync
function.Mostly mocks the dependencies on the file system and utility modules. This allows to easily test the
mainAsync
with a snapshot during local development.Please note that I was not able to accurately verify that this is the expected result. I appreciate if any reviewer put special emphasis on the accuracy of the output.