forked from rosa/hakurei
Compare commits
3 Commits
a3d0a4776c
...
2762e26718
| Author | SHA1 | Date | |
|---|---|---|---|
|
2762e26718
|
|||
|
f793b3c370
|
|||
|
e0ed1f40d1
|
@@ -7,12 +7,12 @@ export interface TestResult {
|
|||||||
// Reporting
|
// Reporting
|
||||||
|
|
||||||
export interface Reporter {
|
export interface Reporter {
|
||||||
update(path: string[], result: TestResult);
|
update(path: string[], result: TestResult): void;
|
||||||
finalize();
|
finalize(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Stream {
|
export interface Stream {
|
||||||
writeln(s: string);
|
writeln(s: string): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class StreamReporter implements Reporter {
|
export class StreamReporter implements Reporter {
|
||||||
@@ -29,6 +29,7 @@ export class StreamReporter implements Reporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update(path: string[], result: TestResult) {
|
update(path: string[], result: TestResult) {
|
||||||
|
if (path.length === 0) throw new RangeError("path is empty");
|
||||||
const pathStr = path.join(' ❯ ');
|
const pathStr = path.join(' ❯ ');
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
this.counts.successes++;
|
this.counts.successes++;
|
||||||
@@ -77,6 +78,7 @@ export class StreamReporter implements Reporter {
|
|||||||
|
|
||||||
export class DOMReporter implements Reporter {
|
export class DOMReporter implements Reporter {
|
||||||
update(path: string[], result: TestResult) {
|
update(path: string[], result: TestResult) {
|
||||||
|
if (path.length === 0) throw new RangeError("path is empty");
|
||||||
const counter = document.getElementById(result.success ? 'successes' : 'failures');
|
const counter = document.getElementById(result.success ? 'successes' : 'failures');
|
||||||
counter.innerText = (Number(counter.innerText) + 1).toString();
|
counter.innerText = (Number(counter.innerText) + 1).toString();
|
||||||
let parent = document.getElementById('root');
|
let parent = document.getElementById('root');
|
||||||
|
|||||||
Reference in New Issue
Block a user