]> git.ardis.lu - seed-phrase-transposer/commitdiff
Log error using console.error and in red for emphasis
authorArdis Lu <ardisglu@gmail.com>
Sat, 13 Jan 2024 06:47:47 +0000 (22:47 -0800)
committerArdis Lu <ardisglu@gmail.com>
Sat, 13 Jan 2024 06:47:47 +0000 (22:47 -0800)
main.ts
main_test.ts

diff --git a/main.ts b/main.ts
index a1d3442e7e6fa47b03034dafc452186993594b00..9270ab035eb2fbf812d1bdc5511fd02df05ad4c6 100644 (file)
--- a/main.ts
+++ b/main.ts
@@ -71,8 +71,9 @@ export function main() {
   const words = parseInput(input);
   const factors = getLowerFactors(words.length);
   if (factors.length === 0) {
-    console.log(
-      `\nNo permutations found. Seed phrase of length ${words.length} can't be arranged into a grid.`,
+    console.error(
+      `%c\nNo permutations found. Seed phrase of length ${words.length} can't be arranged into a grid.`,
+      "color: red",
     );
     Deno.exit(0);
   }
index fd385d8d520a74db2c3e7f41c1f2881a2bd331ab..7ab078d2c00d4e7cf48b5d3930d95008c94e92e2 100644 (file)
@@ -199,7 +199,7 @@ Deno.test("main logs permutations of a 12-word seed phrase", () => {
 });
 
 Deno.test("main exits cleanly on a malformed seed phrase", () => {
-  const consoleSpy = spy(console, "log");
+  const consoleSpy = spy(console, "error");
   const promptStub = stub(
     globalThis,
     "prompt",
@@ -207,7 +207,7 @@ Deno.test("main exits cleanly on a malformed seed phrase", () => {
   );
 
   assertThrows(main); // Calling Deno.exit() within a test throws an error
-  assertSpyCalls(consoleSpy, 1); // console.log was called exactly 1 time
+  assertSpyCalls(consoleSpy, 1); // console.error was called exactly 1 time
 
   consoleSpy.restore();
   promptStub.restore();
This page took 0.050254 seconds and 4 git commands to generate.