-
Notifications
You must be signed in to change notification settings - Fork 29
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
Refactor unit tests to use mocks #41
Conversation
zharinov
commented
Feb 21, 2022
•
edited
Loading
edited
- Rewrite current tests as close to original as possible
- Increase coverage
__tests__/boot.test.ts
Outdated
import * as _core from '@actions/core' | ||
import * as _exec from '@actions/exec' | ||
import * as _io from '@actions/io' | ||
import * as _ioUtil from '@actions/io/lib/io-util' |
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.
Note on io-util
usage: it's hard to just mock fs
module, since it crashes @actions/io
module (here). However, it seems to be a good idea to replace fs
usage to @actions/io/lib/io-util
, as it gives simplicity of synchronous functions while remaining asynchronous via promises usage.
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.
UPD: instead of poorly documented @actions/io/lib/io-util
I've created special fs.ts
file that re-exports functions that are used in the action.
Would you like to ship some parts of this PR separately, or you're okay with this one? |
Sorry, I was busy with other tasks. From the first look, it is amazing. I think tomorrow I will have some time to check it a bit more. Thanks for your contribution! |
Great, thank you 👍 |
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.
LGTM
Thanks again for contribution) |