Skip to content

Commit

Permalink
try resetting colors in test
Browse files Browse the repository at this point in the history
  • Loading branch information
vaaski committed Jul 19, 2024
1 parent 6132066 commit b60df03
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/help.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect, test } from "bun:test"
import { reset } from "kolorist"

const helpOutput = `
Usage: localpen [options]
Expand Down Expand Up @@ -33,7 +34,7 @@ test("print help message", async () => {

await child.exited

expect(text).toBe(helpOutput)
expect(reset(text)).toBe(helpOutput)

Check failure on line 37 in tests/help.test.ts

View workflow job for this annotation

GitHub Actions / test

error: expect(received).toBe(expected)

Expected: "\nUsage: localpen [options]\n\nOptions:\n -h, --help Show this help message\n -t, --template Specify a template to use\n -n, --no-code Don't open the project in VS Code\n\nDeletion options, pick either or get prompted:\n -k, --keep Keep the project folder\n -d, --delete Delete the project folder\n\nAvailable templates:\n - TypeScript/ts\n - JavaScript/js\n - Vite/v\n\nVite templates:\n - lit (-ts)\n - preact (-ts)\n - qwik (-ts)\n - react (-ts)\n - solid (-ts)\n - svelte (-ts)\n - vanilla (-ts)\n - vue (-ts)\n" Received: "\u001B[0m\nUsage: localpen [options]\n\n\u001B[90mOptions:\u001B[39m\n -h, --help \u001B[1mShow this help message\u001B[22m\n -t, --template \u001B[1mSpecify a template to use\u001B[22m\n -n, --no-code \u001B[1mDon't open the project in VS Code\u001B[22m\n\n\u001B[90mDeletion options, pick either or get prompted:\u001B[39m\n -k, --keep \u001B[1mKeep the project folder\u001B[22m\n -d, --delete \u001B[1mDelete the project folder\u001B[22m\n\nAvailable templates:\n - \u001B[34mTypeScript\u001B[39m/\u001B[34mts\u001B[39m\n - \u001B[33mJavaScript\u001B[39m/\u001B[33mjs\u001B[39m\n - \u001B[35mVite\u001B[39m/\u001B[35mv\u001B[39m\n\nVite templates:\n - \u001B[91mlit\u001B[39m (-\u001B[34mts\u001B[39m)\n - \u001B[35mpreact\u001B[39m (-\u001B[34mts\u001B[39m)\n - \u001B[94mqwik\u001B[39m (-\u001B[34mts\u001B[39m)\n - \u001B[36mreact\u001B[39m (-\u001B[34mts\u001B[39m)\n - \u001B[34msolid\u001B[39m (-\u001B[34mts\u001B[39m)\n - \u001B[31msvelte\u001B[39m (-\u001B[34mts\u001B[39m)\n - \u001B[33mvanilla\u001B[39m (-\u001B[34mts\u001B[39m)\n - \u001B[32mvue\u001B[39m (-\u001B[34mts\u001B[39m)\n\u001B[0m" at /home/runner/work/localpen/localpen/tests/help.test.ts:37:22
})

test("print help message on wrong template", async () => {
Expand All @@ -42,6 +43,6 @@ test("print help message on wrong template", async () => {

await child.exited

expect(text).toContain(helpOutput)
expect(text).toContain(" not found")
expect(reset(text)).toContain(helpOutput)

Check failure on line 46 in tests/help.test.ts

View workflow job for this annotation

GitHub Actions / test

error: expect(received).toContain(expected)

Expected to contain: "\nUsage: localpen [options]\n\nOptions:\n -h, --help Show this help message\n -t, --template Specify a template to use\n -n, --no-code Don't open the project in VS Code\n\nDeletion options, pick either or get prompted:\n -k, --keep Keep the project folder\n -d, --delete Delete the project folder\n\nAvailable templates:\n - TypeScript/ts\n - JavaScript/js\n - Vite/v\n\nVite templates:\n - lit (-ts)\n - preact (-ts)\n - qwik (-ts)\n - react (-ts)\n - solid (-ts)\n - svelte (-ts)\n - vanilla (-ts)\n - vue (-ts)\n" Received: "\u001B[0m\u001B[31m\u001B[1mTemplate \u001B[30mfoo\u001B[31m not found\u001B[22m\u001B[39m\n\nUsage: localpen [options]\n\n\u001B[90mOptions:\u001B[39m\n -h, --help \u001B[1mShow this help message\u001B[22m\n -t, --template \u001B[1mSpecify a template to use\u001B[22m\n -n, --no-code \u001B[1mDon't open the project in VS Code\u001B[22m\n\n\u001B[90mDeletion options, pick either or get prompted:\u001B[39m\n -k, --keep \u001B[1mKeep the project folder\u001B[22m\n -d, --delete \u001B[1mDelete the project folder\u001B[22m\n\nAvailable templates:\n - \u001B[34mTypeScript\u001B[39m/\u001B[34mts\u001B[39m\n - \u001B[33mJavaScript\u001B[39m/\u001B[33mjs\u001B[39m\n - \u001B[35mVite\u001B[39m/\u001B[35mv\u001B[39m\n\nVite templates:\n - \u001B[91mlit\u001B[39m (-\u001B[34mts\u001B[39m)\n - \u001B[35mpreact\u001B[39m (-\u001B[34mts\u001B[39m)\n - \u001B[94mqwik\u001B[39m (-\u001B[34mts\u001B[39m)\n - \u001B[36mreact\u001B[39m (-\u001B[34mts\u001B[39m)\n - \u001B[34msolid\u001B[39m (-\u001B[34mts\u001B[39m)\n - \u001B[31msvelte\u001B[39m (-\u001B[34mts\u001B[39m)\n - \u001B[33mvanilla\u001B[39m (-\u001B[34mts\u001B[39m)\n - \u001B[32mvue\u001B[39m (-\u001B[34mts\u001B[39m)\n\u001B[0m" at /home/runner/work/localpen/localpen/tests/help.test.ts:46:22
expect(reset(text)).toContain(" not found")
})

0 comments on commit b60df03

Please sign in to comment.