Skip to content

Commit

Permalink
wip: disable console log
Browse files Browse the repository at this point in the history
  • Loading branch information
galargh committed Oct 6, 2024
1 parent bab6938 commit b2bc7ec
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions v-next/hardhat/test/internal/cli/init/init.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from "node:assert/strict";
import path from "node:path";
import { describe, it } from "node:test";
import { after, before, describe, it } from "node:test";

import { HardhatError } from "@ignored/hardhat-vnext-errors";
import {
Expand All @@ -25,8 +25,22 @@ import {
} from "../../../../src/internal/cli/init/init.js";
import { getTemplates } from "../../../../src/internal/cli/init/template.js";

function disableConsoleLog() {
const originalLog = console.log;

before(() => {
console.log = () => {};
});

after(() => {
console.log = originalLog;
});
}

// NOTE: This uses network to access the npm registry
describe("printWelcomeMessage", () => {
disableConsoleLog();

it("should not throw if latest version of hardhat cannot be retrieved from the registry", async () => {
await printWelcomeMessage();
});
Expand Down Expand Up @@ -147,9 +161,11 @@ describe("copyProjectFiles", () => {
});
});

describe("installProjectDependencies", () => {
describe.only("installProjectDependencies", () => {
useTmpDir("installProjectDependencies");

disableConsoleLog();

describe("when install is true", () => {
// This test is skipped because installing dependencies over the network is slow
it.skip("should install the project dependencies", async () => {
Expand All @@ -176,6 +192,8 @@ describe("installProjectDependencies", () => {
describe("initHardhat", async () => {
useTmpDir("initHardhat");

disableConsoleLog();

const templates = await getTemplates();

for (const template of templates) {
Expand Down

0 comments on commit b2bc7ec

Please sign in to comment.