diff --git a/cmd/pkgserver/ui/static/test.ts b/cmd/pkgserver/ui/static/test.ts index 5de9bff5..b3b83742 100644 --- a/cmd/pkgserver/ui/static/test.ts +++ b/cmd/pkgserver/ui/static/test.ts @@ -8,6 +8,7 @@ export interface TestResult { export interface Reporter { update(path: string[], result: TestResult): void; + finalize(): void; } export interface Stream { @@ -40,7 +41,7 @@ export class StreamReporter implements Reporter { } } - display() { + finalize() { // Transform [{ path: ['a', 'b', 'c'] }, { path: ['a', 'b', 'd'] }] // into { 'a ❯ b': ['c', 'd'] }. let pathMap = new Map(); @@ -117,6 +118,8 @@ export class DOMReporter implements Reporter { } parent.appendChild(p); } + + finalize() {} } let r = typeof document !== 'undefined' ? new DOMReporter() : new StreamReporter({ writeln: console.log }); @@ -127,4 +130,4 @@ r.update(['Tetromino', 'generate', 'tessellates'], { success: false, output: 'as r.update(['Tetromino', 'solve', 'works'], { success: true, output: '' }); r.update(['discombobulate'], { success: false, output: 'hippopotamonstrosesquippedaliophobia' }); r.update(['recombobulate'], { success: true, output: '' }); -if (r instanceof StreamReporter) r.display(); +r.finalize();