-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(helmfile-dependency-check): new helmfile deps strategy (#63)
* initial commit * updated readme and dist * updated test * updated test * added example outputs to readme * made mock more generic * pass working dir to shell command Co-authored-by: Charles Sullivan <[email protected]> Co-authored-by: Marcin Dobosz <[email protected]>
- Loading branch information
1 parent
c6a6e4c
commit 5c2b0e3
Showing
15 changed files
with
374 additions
and
232 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
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,10 @@ | ||
const child_process = jest.createMockFromModule("child_process") | ||
|
||
function execSync(command: string): Buffer { | ||
const buffer = Buffer.from(`executed: ${command}`) | ||
return buffer | ||
} | ||
|
||
(child_process as any).execSync = execSync | ||
|
||
module.exports = child_process |
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,29 @@ | ||
const fs = jest.genMockFromModule("fs"); | ||
|
||
let mockFiles: string[] | null = null; | ||
|
||
function __setMockFiles(newMockFiles: string[]): void { | ||
mockFiles = newMockFiles | ||
} | ||
|
||
function readFileSync(path: string, encoding: string): string { | ||
if (mockFiles.length === 0) { | ||
return "" | ||
} | ||
return mockFiles.shift() | ||
} | ||
|
||
function existsSync(path: string): boolean { | ||
if (RegExp(/helmfile-missing\/helmfile\.yaml/).exec(path)) { | ||
return false | ||
} else if (RegExp(/helmfile-lock-missing\/helmfile\.lock/).exec(path)) { | ||
return false | ||
} | ||
return true | ||
} | ||
|
||
(fs as any).__setMockFiles = __setMockFiles; | ||
(fs as any).readFileSync = readFileSync; | ||
(fs as any).existsSync = existsSync; | ||
|
||
module.exports = fs; |
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
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
Oops, something went wrong.