-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix putProtocolArtifact specs when run as a part of the unit test suite
- Loading branch information
1 parent
4e839a4
commit d4cab4d
Showing
3 changed files
with
40 additions
and
19 deletions.
There are no files selected for viewing
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,22 @@ | ||
import mockery from 'mockery' | ||
import path from 'path' | ||
|
||
export const mockElectron = (mockeryInstance: typeof mockery) => { | ||
// stub out the entire electron object for our stub | ||
// we must use an absolute path here because of the way mockery internally loads this | ||
// module - meaning the first time electron is required it'll use this path string | ||
// so because its required from a separate module we must use an absolute reference to it | ||
mockeryInstance.registerSubstitute( | ||
'electron', | ||
path.join(__dirname, './support/helpers/electron_stub'), | ||
) | ||
|
||
// stub out electron's original-fs module which is available when running in electron | ||
mockeryInstance.registerMock('original-fs', {}) | ||
} | ||
|
||
export const enable = (mockeryInstance: typeof mockery) => { | ||
mockeryInstance.enable({ | ||
warnOnUnregistered: false, | ||
}) | ||
} |
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