Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hipstersmoothie committed May 21, 2021
1 parent e53e94a commit 5fa091a
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/core/src/__tests__/auto-env.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Auto } from "../auto";

jest.mock("fs", () => ({
read: () => undefined,
readFileSync: () => 'FOO="test value"',
closeSync: () => undefined,
existsSync: () => true,
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/__tests__/release.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ jest.mock("fs", () => ({
writeFile: (file, data, cb) => {
cb(undefined, writeSpy(file, data));
},
// @ts-ignore
read: (a, b, cb) => {
cb(undefined);
},
}));

const logParse = new LogParse();
Expand Down
4 changes: 4 additions & 0 deletions plugins/brew/__tests__/brew.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ const readFileSync = jest.fn();
const writeFileSync = jest.fn();

jest.mock("fs", () => ({
// @ts-ignore
read: (a, b, cb) => {
cb(undefined);
},
// @ts-ignore
existsSync: (...args) => existsSync(...args),
// @ts-ignore
Expand Down
4 changes: 4 additions & 0 deletions plugins/crates/__tests__/crates.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ jest.mock("fs", () => ({
// @ts-ignore
existsSync: (...args) => existsSync(...args),
// @ts-ignore
read: (a, b, cb) => {
cb(undefined, readResult);
},
// @ts-ignore
readFile: (a, b, cb) => {
cb(undefined, readResult);
},
Expand Down
4 changes: 4 additions & 0 deletions plugins/maven/__tests__/maven.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ jest.mock("fs", () => ({
WriteStream: function () {},
// @ts-ignore
closeSync: () => undefined,
// @ts-ignore
read: (a, b, cb) => {
cb(undefined);
},
}));

jest.mock("child_process");
Expand Down
4 changes: 4 additions & 0 deletions plugins/npm/__tests__/monorepo-log.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ jest.mock("fs", () => ({
readFile: jest.fn(),
// @ts-ignore
readFileSync: () => readFileSync(),
// @ts-ignore
read: (a, b, cb) => {
cb(undefined);
},
ReadStream: function () {},
WriteStream: function () {},
// @ts-ignore
Expand Down
2 changes: 1 addition & 1 deletion scripts/jest-setup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
require("mock-fs");

jest.mock('requireg', () => require);
jest.mock('requireg', () => require);

0 comments on commit 5fa091a

Please sign in to comment.