Skip to content

Commit abd5f3e

Browse files
committed
add test
1 parent 03d4484 commit abd5f3e

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

wasm/src/cli.test.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ describe('With wasm CLI', async () => {
7979
defaultProjectID: ""
8080
}
8181

82-
await cli.configureOutput({width: 100})
82+
await cli.configureOutput({width: 100, color: false})
8383
const resp = await cli.run(runCfg, ['marketplace', 'image', 'list'])
8484
console.log(resp)
8585
expect(resp.exitCode).toBe(0)
@@ -88,6 +88,21 @@ describe('With wasm CLI', async () => {
8888
expect(lines[2].length).toBeLessThan(100)
8989
})
9090

91+
it('can enable colors', async () => {
92+
const runCfg = {
93+
jwt: "",
94+
defaultProjectID: ""
95+
}
96+
97+
await cli.configureOutput({width: 100, color: false})
98+
const resp = await cli.run(runCfg, ['invalid'])
99+
await cli.configureOutput({width: 100, color: true})
100+
const coloredResp = await cli.run(runCfg, ['invalid'])
101+
102+
expect(coloredResp.stderr.length).toBeGreaterThan(resp.stderr.length)
103+
expect(coloredResp.stderr).not.toEqual(resp.stderr)
104+
})
105+
91106
afterAll(async () => {
92107
try {
93108
await cli.stop()

0 commit comments

Comments
 (0)