Skip to content

Commit

Permalink
chore(tests): mocked the console object in tests
Browse files Browse the repository at this point in the history
Created a dummy console to supress warnings in the console when running tests

re #204
  • Loading branch information
mimshwright committed Feb 25, 2022
1 parent 89bf6c8 commit 0d3266e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ module.exports = {
preset: "ts-jest",
runner: "@jest-runner/electron",
testEnvironment: "@jest-runner/electron/environment",
setupFiles: ["<rootDir>/test/mockConsole.ts"],
};
5 changes: 4 additions & 1 deletion jest.config.vscode.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "jsdom",
setupFiles: ["<rootDir>/test/setup.ts"],
setupFiles: [
"<rootDir>/test/mockConsole.ts",
"<rootDir>/test/mockContext.ts",
],
};
6 changes: 6 additions & 0 deletions test/mockConsole.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// eslint-disable-next-line @typescript-eslint/no-empty-function
const noop = () => {};

globalThis.console.log = noop;
globalThis.console.warn = noop;
globalThis.console.error = noop;
File renamed without changes.

0 comments on commit 0d3266e

Please sign in to comment.