diff --git a/journey/pepr-dev.ts b/journey/pepr-dev.ts index 06c0d492e..30b3ac9a2 100644 --- a/journey/pepr-dev.ts +++ b/journey/pepr-dev.ts @@ -65,7 +65,6 @@ export function peprDev() { // Convert buffer to string const strData = data.toString(); - console.log(strData); // Check if any expected lines are found expectedLines = expectedLines.filter(expectedLine => { @@ -73,11 +72,10 @@ export function peprDev() { return !strData.replace(/\s+/g, " ").includes(expectedLine); }); - console.info(`Expected lines remaining: ${expectedLines.length}`); - console.debug(`Remaining expected lines: ${expectedLines}`); - // If all expected lines are found, resolve the promise - if (expectedLines.length < 1) { + if (expectedLines.length > 0) { + console.log(`still waiting on ${expectedLines.length} lines...`); + } else { // Abort all further processing success = true; diff --git a/src/cli/init/walkthrough.test.ts b/src/cli/init/walkthrough.test.ts index 92863bd22..d6e67d0dc 100644 --- a/src/cli/init/walkthrough.test.ts +++ b/src/cli/init/walkthrough.test.ts @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: 2023-Present The Pepr Authors -import { describe, expect, it } from "@jest/globals"; +import { afterAll, beforeAll, describe, expect, jest, it } from "@jest/globals"; import prompts from "prompts"; import { walkthrough, @@ -12,7 +12,20 @@ import { setErrorBehavior, } from "./walkthrough"; +let consoleLog: jest.Spied; +let consoleError: jest.Spied; + describe("when processing input", () => { + beforeAll(() => { + consoleLog = jest.spyOn(console, "log").mockImplementation(() => {}); + consoleError = jest.spyOn(console, "error").mockImplementation(() => {}); + }); + + afterAll(() => { + consoleLog.mockRestore(); + consoleError.mockRestore(); + }); + describe("walkthough() returns expected results", () => { it.each([ //Test flag combinations with [["$FLAG", ...]]