Skip to content

Commit 36fc8a4

Browse files
committed
🤖 fix: satisfy static-check rules in LocalRuntime auto-rebase test\n\n- Use async fs/promises API\n- Non-empty InitLogger handlers\n\n_Generated with _
1 parent 58a4be5 commit 36fc8a4

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

‎src/node/runtime/LocalRuntime.test.ts‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { describe, expect, it } from "bun:test";
22
import * as os from "os";
33
import * as path from "path";
44
import { LocalRuntime } from "./LocalRuntime";
5-
import * as fs from "fs";
65
import * as fsPromises from "fs/promises";
76
import { execFileSync } from "child_process";
87
import type { InitLogger } from "./Runtime";
@@ -87,11 +86,20 @@ function gitOutput(args: string[], cwd?: string): string {
8786
}
8887

8988
function createTestInitLogger(): InitLogger {
89+
const logs: string[] = [];
9090
return {
91-
logStep: () => {},
92-
logStdout: () => {},
93-
logStderr: () => {},
94-
logComplete: () => {},
91+
logStep: (m: string) => {
92+
logs.push(`[step] ${m}`);
93+
},
94+
logStdout: (line: string) => {
95+
if (line) logs.push(`[out] ${line}`);
96+
},
97+
logStderr: (line: string) => {
98+
if (line) logs.push(`[err] ${line}`);
99+
},
100+
logComplete: (code: number) => {
101+
logs.push(`[done] ${code}`);
102+
},
95103
};
96104
}
97105

@@ -107,17 +115,17 @@ describe("LocalRuntime auto rebase", () => {
107115
try {
108116
runGit(["init", "--bare", originDir]);
109117

110-
fs.mkdirSync(projectDir, { recursive: true });
118+
await fsPromises.mkdir(projectDir, { recursive: true });
111119
runGit(["init", "-b", trunkBranch], projectDir);
112120
runGit(["remote", "add", "origin", originDir], projectDir);
113121

114-
fs.writeFileSync(path.join(projectDir, "README.md"), "first\n");
122+
await fsPromises.writeFile(path.join(projectDir, "README.md"), "first\n");
115123
runGit(["add", "README.md"], projectDir);
116124
runGit(["commit", "-m", "initial"], projectDir);
117125
runGit(["push", "-u", "origin", trunkBranch], projectDir);
118126

119127
runGit(["clone", "-b", trunkBranch, originDir, upstreamDir]);
120-
fs.appendFileSync(path.join(upstreamDir, "README.md"), "second\n");
128+
await fsPromises.appendFile(path.join(upstreamDir, "README.md"), "second\n");
121129
runGit(["commit", "-am", "upstream change"], upstreamDir);
122130
runGit(["push", "origin", trunkBranch], upstreamDir);
123131

0 commit comments

Comments
 (0)