-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(util): Eliminate side-effects on import
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.
- Loading branch information
1 parent
f4d23f7
commit 7f9f984
Showing
6 changed files
with
42 additions
and
39 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { jest } from "@jest/globals"; | ||
|
||
import type { promisify } from "node:util"; | ||
|
||
export const utilFactory = (): { | ||
promisify: Omit<typeof promisify, "custom">; | ||
} => ({ | ||
promisify: jest.fn<typeof promisify>(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters