From 61fb0df37fb1c477e7d27c0a5cb66a737909edd3 Mon Sep 17 00:00:00 2001 From: dimaslz Date: Sun, 28 Jan 2024 19:25:21 +0100 Subject: [PATCH] test(cli): update tests --- .../cli/src/__snapshots__/list-container.test.ts.snap | 10 +++++----- packages/cli/src/list-container.ts | 10 ++++++++++ packages/cli/vitest.config.mts | 3 --- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/packages/cli/src/__snapshots__/list-container.test.ts.snap b/packages/cli/src/__snapshots__/list-container.test.ts.snap index 88529d0..602210b 100644 --- a/packages/cli/src/__snapshots__/list-container.test.ts.snap +++ b/packages/cli/src/__snapshots__/list-container.test.ts.snap @@ -5,11 +5,11 @@ exports[`Actions - listContainer > success > commmand found local-ssl-management "calls": [ [ " -┌──────────────┬──────────────────────┬──────────────────────────────────────────┐ -│ container id │ container image │ port │ -├──────────────┼──────────────────────┼──────────────────────────────────────────┤ -│ XXXXXXXXXXXX │ local-ssl-management │ 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp │ -└──────────────┴──────────────────────┴──────────────────────────────────────────┘ +┌──────────────┬──────────────────────┬──────────────────────────────────────────┐ +│ container id │ container image │ port │ +├──────────────┼──────────────────────┼──────────────────────────────────────────┤ +│ XXXXXXXXXXXX │ local-ssl-management │ 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp │ +└──────────────┴──────────────────────┴──────────────────────────────────────────┘ ", ], ], diff --git a/packages/cli/src/list-container.ts b/packages/cli/src/list-container.ts index cf3325a..3c0c716 100644 --- a/packages/cli/src/list-container.ts +++ b/packages/cli/src/list-container.ts @@ -2,6 +2,8 @@ import Table from "cli-table3"; import consola from "consola"; import shell from "shelljs"; +const isTest = process.env.NODE_ENV === "test"; + const listContainer = () => { const containersList = shell.exec( "docker ps --format '{{.ID}} | {{.Names}} | {{.Ports}}'", @@ -10,6 +12,14 @@ const listContainer = () => { const table = new Table({ head: ["container id", "container image", "port"], + ...(isTest + ? { + style: { + head: [], //disable colors in header cells + border: [], //disable colors for the border + }, + } + : {}), }); const containerData = diff --git a/packages/cli/vitest.config.mts b/packages/cli/vitest.config.mts index bbc106c..6221836 100644 --- a/packages/cli/vitest.config.mts +++ b/packages/cli/vitest.config.mts @@ -11,9 +11,6 @@ export default mergeConfig( environment: "node", setupFiles: "./global-setup.ts", clearMocks: true, - snapshotFormat: { - printBasicPrototype: false, - }, }, resolve: { alias: {