Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.

Commit 6675ec7

Browse files
chore: remove console log on tests
1 parent 5125caa commit 6675ec7

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

tests/token.test.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,29 @@ import { executeCommand, deleteFile, SAMPLE_TOKEN } from "./test-utils";
1010
jest.mock("inquirer");
1111
const { prompt, expectPrompts } = require("inquirer");
1212

13-
beforeEach(async () => {
14-
// delete our testing config file before starting
15-
deleteFile(store.path);
16-
});
13+
function setup() {
14+
beforeEach(() => {
15+
// delete our testing config file before starting
16+
deleteFile(store.path);
17+
// suppress logs
18+
global.console = {
19+
log: jest.fn(),
20+
};
21+
});
22+
afterEach(() => {
23+
global.console = {
24+
log: console.log,
25+
};
26+
});
27+
}
1728

1829
test("ensure we're using a temp store folder", () => {
1930
expect(store.path).toMatch(/cli-testing/);
2031
});
2132

2233
describe("codiga token-add", () => {
34+
setup();
35+
2336
test("first notice shows", async () => {
2437
// run the command
2538
await executeCommand([ACTION_TOKEN_ADD]).catch(({ stdout }) => {
@@ -101,6 +114,8 @@ describe("codiga token-add", () => {
101114
});
102115

103116
describe("codiga token-check", () => {
117+
setup();
118+
104119
test("no token", async () => {
105120
// run the command
106121
await executeCommand([ACTION_TOKEN_CHECK]).catch(({ stdout }) => {
@@ -130,6 +145,8 @@ describe("codiga token-check", () => {
130145
});
131146

132147
describe("codiga token-delete", () => {
148+
setup();
149+
133150
test("no token found", async () => {
134151
// run the command
135152
await executeCommand([ACTION_TOKEN_DELETE]).catch(({ stdout }) => {

0 commit comments

Comments
 (0)