Skip to content

Commit a0dd7ce

Browse files
committed
fix
1 parent c9e5467 commit a0dd7ce

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

src/assertResult.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ export class AssertResult {
4444
}
4545

4646
print(log: (msg: string) => void): void {
47-
const render = (failed: number, total: number) =>
48-
(this.fail === 0 ? chalk.greenBright(total) : chalk.redBright(total - failed)) + "/" + this.total.toString();
49-
log(`\ntest case: ${render(this.fail, this.total)} (success/total)\n`);
47+
const rate =
48+
(this.fail === 0 ? chalk.greenBright(this.total) : chalk.redBright(this.total - this.fail)) +
49+
"/" +
50+
this.total.toString();
51+
log(`\ntest case: ${rate} (success/total)\n`);
5052
if (this.fail !== 0) {
5153
log(chalk.red("Error Message: "));
5254
for (const [testcaseName, { assertMessages, logMessages }] of this.failedInfos.entries()) {

src/core/executionRecorder.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class LogRecorder {
2727
}
2828
}
2929

30-
// TODO: split execution environment and recorder
30+
// to do: split execution environment and recorder
3131
export class ExecutionRecorder implements IAssertResult, UnitTestFramework {
3232
total: number = 0;
3333
fail: number = 0;
@@ -53,8 +53,8 @@ export class ExecutionRecorder implements IAssertResult, UnitTestFramework {
5353
this.#logRecorder.onStartTest();
5454
}
5555
_finishTestFunction(): void {
56-
let logMessages: string[] | null = this.#logRecorder.onFinishTest();
57-
if (logMessages != null) {
56+
const logMessages: string[] | null = this.#logRecorder.onFinishTest();
57+
if (logMessages !== null) {
5858
const testCaseFullName = this.#currentTestDescription;
5959
this.failedLogMessages[testCaseFullName] = (this.failedLogMessages[testCaseFullName] || []).concat(logMessages);
6060
}

src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { emptydirSync } from "fs-extra";
33
import { ASUtil } from "@assemblyscript/loader";
44
import { Parser } from "./parser/index.js";
55
import { compile } from "./core/compile.js";
6-
import { AssertResult } from "./assertResult.js";
76
import { precompile } from "./core/precompile.js";
87
import { instrument } from "./core/instrument.js";
98
import { execWasmBinaries } from "./core/execute.js";

tests/ts/test/assertResult.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ test("print", async () => {
7171
const expectInfoFIlePath = join(__dirname, "..", "fixture", "assertResultTest.expectInfo.json");
7272
await assertResult.merge(testcaseA, expectInfoFIlePath);
7373

74-
let outputs: string[] = [];
74+
const outputs: string[] = [];
7575
assertResult.print((msg) => outputs.push(msg));
7676

7777
expect(outputs.join("\n")).toMatchSnapshot();

0 commit comments

Comments
 (0)