Skip to content

Commit

Permalink
test(cli): update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaslz committed Jan 28, 2024
1 parent 7c13103 commit 61fb0df
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
10 changes: 5 additions & 5 deletions packages/cli/src/__snapshots__/list-container.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ exports[`Actions - listContainer > success > commmand found local-ssl-management
"calls": [
[
"
[90m┌──────────────[39m[90m┬──────────────────────[39m[90m┬──────────────────────────────────────────┐[39m
[90m│[39m[31m container id [39m[90m│[39m[31m container image [39m[90m│[39m[31m port [39m[90m│[39m
[90m├──────────────[39m[90m┼──────────────────────[39m[90m┼──────────────────────────────────────────┤[39m
[90m│[39m XXXXXXXXXXXX [90m│[39m local-ssl-management [90m│[39m 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp [90m│[39m
[90m└──────────────[39m[90m┴──────────────────────[39m[90m┴──────────────────────────────────────────┘[39m
┌──────────────┬──────────────────────┬──────────────────────────────────────────
container id container image port
├──────────────┼──────────────────────┼──────────────────────────────────────────┤
XXXXXXXXXXXX local-ssl-management 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp
└──────────────┴──────────────────────┴──────────────────────────────────────────┘
",
],
],
Expand Down
10 changes: 10 additions & 0 deletions packages/cli/src/list-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}}'",
Expand All @@ -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 =
Expand Down
3 changes: 0 additions & 3 deletions packages/cli/vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ export default mergeConfig(
environment: "node",
setupFiles: "./global-setup.ts",
clearMocks: true,
snapshotFormat: {
printBasicPrototype: false,
},
},
resolve: {
alias: {
Expand Down

0 comments on commit 61fb0df

Please sign in to comment.