Skip to content
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(util): Eliminate side-effects on import #466

Merged
merged 1 commit into from
Mar 28, 2023
Merged

Conversation

Kurt-von-Laven
Copy link
Contributor

Move the util.promisify() call in src/util.ts from the top level to execBashCommand(). Mock util.promisify() in tests now that it is simpler to do so before util.promisify() is called. Introduce src/mocks/util.ts to share the util mock factory between tests.

@Kurt-von-Laven Kurt-von-Laven self-assigned this Mar 25, 2023
Copy link
Contributor

@mwarres mwarres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Move the util.promisify() call in src/util.ts from the top level to
execBashCommand(). Mock util.promisify() in tests now that it is simpler
to do so before util.promisify() is called. Introduce src/mocks/util.ts
to share the util mock factory between tests.
@Kurt-von-Laven
Copy link
Contributor Author

I was able to simplify considerably by replacing some unnecessary uses of mockImplementation* with mockReturnValue*.

Copy link
Contributor

@mwarres mwarres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, I'm not sure about the syntax on the area I commented on though.

Copy link
Contributor

@mwarres mwarres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Kurt-von-Laven Kurt-von-Laven merged commit 7f9f984 into main Mar 28, 2023
@Kurt-von-Laven Kurt-von-Laven deleted the util branch March 28, 2023 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants