Skip to content

Commit

Permalink
fix: color middleware test in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitsunee committed Nov 24, 2024
1 parent e81a2eb commit e07cd6c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/formatName.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { padStr } from "./padStr";
import type { ResolvedLevelOpts } from "./types";

const colorSupport = {
export const colorSupport = {
stdout: process.stdout?.hasColors?.() ?? false,
stderr: process.stderr?.hasColors?.() ?? false
};
Expand Down
12 changes: 10 additions & 2 deletions tests/formatName.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import { test } from "uvu";
import * as assert from "uvu/assert";
import * as col from "picocolors";
import { formatName } from "../src/formatName";
import * as picocolors from "picocolors";
import { colorSupport, formatName } from "../src/formatName";
import type { ResolvedLevelOpts } from "../src/types";

console.log(
`Color Support detected:
stdout: ${colorSupport.stdout} (${colorSupport.stdout ? "Using color in tests" : "⚠️ Disabling color in tests"})
stderr: ${colorSupport.stderr}`
);

const col = picocolors.createColors(colorSupport.stdout);

test("transform name variables in template", () => {
const level: ResolvedLevelOpts<"test"> = {
name: "test",
Expand Down

0 comments on commit e07cd6c

Please sign in to comment.