diff --git a/package.json b/package.json index 05368e7a..d0856b27 100644 --- a/package.json +++ b/package.json @@ -77,8 +77,7 @@ "pkg-ok": "^3.0.0", "pretty-bytes": "^7.0.0", "rimraf": "^6.0.1", - "server-destroy": "^1.0.1", - "strip-ansi": "^7.1.0" + "server-destroy": "^1.0.1" }, "dependencies": { "@nodesecure/documentation-ui": "^1.3.0", diff --git a/test/commands/summary.test.js b/test/commands/summary.test.js index ac59e851..fb0cd72a 100644 --- a/test/commands/summary.test.js +++ b/test/commands/summary.test.js @@ -5,9 +5,9 @@ dotenv.config(); import { fileURLToPath } from "node:url"; import path from "node:path"; import { describe, it } from "node:test"; +import { stripVTControlCharacters } from "node:util"; // Import Third-party Dependencies -import stripAnsi from "strip-ansi"; import * as i18n from "@nodesecure/i18n"; // Import Internal Dependencies @@ -47,7 +47,7 @@ describe("CLI Commands: summary", () => { for await (const line of runProcess(processOptions)) { const regexp = lines.shift(); t.assert.ok(regexp, "we are expecting this line"); - t.assert.ok(regexp.test(stripAnsi(line)), `line (${line}) matches ${regexp}`); + t.assert.ok(regexp.test(stripVTControlCharacters(line)), `line (${line}) matches ${regexp}`); } }); @@ -66,7 +66,7 @@ describe("CLI Commands: summary", () => { for await (const line of runProcess(processOptions)) { const expectedLineRegex = expectedLines.shift(); - const formattedLine = stripAnsi(line); + const formattedLine = stripVTControlCharacters(line); t.assert.ok(expectedLineRegex, "we are expecting this line"); t.assert.ok(expectedLineRegex.test(formattedLine), `line (${formattedLine}) should match ${expectedLineRegex}`); } diff --git a/test/helpers/cliCommandRunner.js b/test/helpers/cliCommandRunner.js index 18880631..76812dc4 100644 --- a/test/helpers/cliCommandRunner.js +++ b/test/helpers/cliCommandRunner.js @@ -1,10 +1,10 @@ // Import Node.js Dependencies import { fork } from "node:child_process"; import { createInterface } from "node:readline"; +import { stripVTControlCharacters } from "node:util"; // Import Third-party Dependencies import { MockAgent, setGlobalDispatcher } from "undici"; -import stripAnsi from "strip-ansi"; export async function* runProcess(options) { const { path, args = [], cwd = process.cwd(), undiciMockAgentOptions = null } = options; @@ -20,7 +20,7 @@ export async function* runProcess(options) { const rStream = createInterface(childProcess.stdout); for await (const line of rStream) { - yield stripAnsi(line); + yield stripVTControlCharacters(line); } } finally {