Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
030490f
Add color palette with base 16 + semantic tokens
DmitrySharabin Apr 24, 2026
665edfb
Move format-console.js under src/util/
DmitrySharabin Apr 24, 2026
1ce749a
Replace format-console tests with new spec coverage
DmitrySharabin Apr 24, 2026
886bb52
Drop unused chalk devDependency
DmitrySharabin Apr 24, 2026
9da0c8c
Rewrite format-console.js with tokenizer + ANSI/CSS backends
DmitrySharabin Apr 24, 2026
38c9cb8
Migrate TestResult.js to semantic color tokens
DmitrySharabin Apr 24, 2026
233d8d2
Use highlight token for active group icon
DmitrySharabin Apr 24, 2026
db11048
Spread format() CSS array into console calls
DmitrySharabin Apr 24, 2026
d289084
Spread format() CSS array in render.js details onclick
DmitrySharabin Apr 24, 2026
a0ad8f7
Tune green palette for readability
DmitrySharabin Apr 24, 2026
447d7f1
Make palette WCAG-compliant (accessible badge labels + skip token)
DmitrySharabin Apr 24, 2026
1fcd54d
Formatting
DmitrySharabin Apr 24, 2026
97dc42d
Add diff-added-emph and diff-removed-emph tokens for inline highlights
DmitrySharabin Apr 24, 2026
9295bec
Prettier
DmitrySharabin Apr 24, 2026
c09782a
Palette works fine in the light mode also
DmitrySharabin Apr 24, 2026
504fc96
Add tests for null-skip, FORCE_COLOR=2, 3-char hex, empty input
DmitrySharabin Apr 24, 2026
d8bf532
Simplify code
DmitrySharabin Apr 24, 2026
23277ba
Iterate
DmitrySharabin Apr 24, 2026
665dd3d
Unexport detectMode, cover all modes with shared args
DmitrySharabin Apr 24, 2026
a1df89c
Simplify format-console emitters
DmitrySharabin Apr 24, 2026
40476ec
Add reset modifier for ANSI reset escape
DmitrySharabin Apr 24, 2026
a7edbc5
Collapse format() options into positional mode
DmitrySharabin Apr 24, 2026
3daa746
Migrate format-diff to semantic color tokens
DmitrySharabin Apr 24, 2026
7376003
Add -tint semantic color tokens; migrate TestResult badges
DmitrySharabin Apr 24, 2026
12cfe9a
Derive badge color from label via toLowerCase
DmitrySharabin Apr 24, 2026
00fb4f2
Derive format-console test expectations from palette
DmitrySharabin Apr 28, 2026
d5f24d0
Trim escape() comment
DmitrySharabin Apr 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"@11ty/eleventy": "^3.1.5",
"@11ty/eleventy-navigation": "^1.0.5",
"@stylistic/eslint-plugin": "latest",
"chalk": "^5.6.2",
"eleventy-plugin-toc": "^1.1.5",
"eslint": "latest",
"globals": "latest",
Expand Down
14 changes: 7 additions & 7 deletions src/classes/TestResult.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Test from "./Test.js";
import BubblingEventTarget from "./BubblingEventTarget.js";
import { stripFormatting } from "../format-console.js";
import { stripFormatting } from "../util/format-console.js";
import { delay, formatDuration, interceptConsole, pluralize, stringify } from "../util.js";
import { formatDiff } from "../util/format-diff.js";

Expand Down Expand Up @@ -358,11 +358,11 @@ ${ this.error.stack }`);
* @returns {string}
*/
getResult (o) {
let color = this.pass ? "green" : this.skipped ? "yellow" : "red";
let label = this.pass ? "PASS" : this.skipped ? "SKIP" : "FAIL";
let color = label.toLowerCase();
let ret = [
`<b><bg ${color}><c white> ${ label } </c></bg></b>`,
`<c light${color}>${this.name ?? "(Anonymous)"}</c>`,
`<b><bg ${color}><c text> ${ label } </c></bg></b>`,
`<c ${color}-tint>${this.name ?? "(Anonymous)"}</c>`,
].join(" ");

if (this.messages?.length > 0) {
Expand Down Expand Up @@ -392,11 +392,11 @@ ${ this.error.stack }`);
];

if (stats.pass > 0) {
ret.push(`<c green><b>${ stats.pass }</b>/${ stats.total } PASS</c>`);
ret.push(`<c pass><b>${ stats.pass }</b>/${ stats.total } PASS</c>`);
}

if (stats.fail > 0) {
ret.push(`<c red><b>${ stats.fail }</b>/${ stats.total } FAIL</c>`);
ret.push(`<c fail><b>${ stats.fail }</b>/${ stats.total } FAIL</c>`);
}

if (stats.pending > 0) {
Expand Down Expand Up @@ -431,7 +431,7 @@ ${ this.error.stack }`);
* @returns {string}
*/
getMessages (o = {}) {
let ret = new String("<c yellow><b><i>(Messages)</i></b></c>");
let ret = new String("<c message><b><i>(Messages)</i></b></c>");
ret.children = this.messages.map(m => `<dim>(${ m.method })</dim> ${ m.args.map(a => stringify(a)).join(" ") }`);

return o?.format === "rich" ? ret : stripFormatting(ret);
Expand Down
6 changes: 3 additions & 3 deletions src/env/console.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import format from "../format-console.js";
import format from "../util/format-console.js";

function printTree (str, parent) {
if (str.children?.length > 0) {
console["group" + (parent ? "Collapsed" : "")](format(str));
console["group" + (parent ? "Collapsed" : "")](...format(str, "css"));
for (let child of str.children) {
printTree(child, str);
}
console.groupEnd();
}
else {
console.log(format(str));
console.log(...format(str, "css"));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/env/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { AsciiTree } from "oo-ascii-tree";
import { globSync } from "glob";

// Internal modules
import format from "../format-console.js";
import format from "../util/format-console.js";
import { getType } from "../util.js";

/**
Expand Down Expand Up @@ -60,7 +60,7 @@ function getTree (msg, i) {

let icon = collapsed ? icons.collapsed : icons.expanded;
if (highlighted) {
icon = `<c green><b>${ collapsed ? icons.collapsedHighlighted : icons.expandedHighlighted }</b></c>`;
icon = `<c highlight><b>${ collapsed ? icons.collapsedHighlighted : icons.expandedHighlighted }</b></c>`;
msg = `<b>${ msg }</b>`;
}
msg = icon + " " + msg;
Expand Down
117 changes: 0 additions & 117 deletions src/format-console.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import TestResult from "./classes/TestResult.js";
import RefTest from "https://html.htest.dev/src/classes/RefTest.js";
import { create, output } from "https://html.htest.dev/src/util.js";
import { formatDuration } from "./util.js";
import format from "./format-console.js";
import format from "./util/format-console.js";

export default function render (test) {
let root = new Test(test);
Expand Down Expand Up @@ -83,7 +83,7 @@ export default function render (test) {
}
else if (!target.pass) {
cell.classList.add("details");
cell.onclick = () => console.log(target.details.map(format).join("\n"));
cell.onclick = () => console.log(...format(target.details.join("\n")));
}
tr.dataset.time = formatDuration(target.timeTaken);
}
Expand Down
Loading