mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +00:00
perf: cache local tsgo checks
This commit is contained in:
@@ -31,7 +31,16 @@ describe("local-heavy-check-runtime", () => {
|
||||
it("tightens local tsgo runs on constrained hosts", () => {
|
||||
const { args, env } = applyLocalTsgoPolicy([], makeEnv(), CONSTRAINED_HOST);
|
||||
|
||||
expect(args).toEqual(["--declaration", "false", "--singleThreaded", "--checkers", "1"]);
|
||||
expect(args).toEqual([
|
||||
"--declaration",
|
||||
"false",
|
||||
"--incremental",
|
||||
"--tsBuildInfoFile",
|
||||
".artifacts/tsgo-cache/root.tsbuildinfo",
|
||||
"--singleThreaded",
|
||||
"--checkers",
|
||||
"1",
|
||||
]);
|
||||
expect(env.GOGC).toBe("30");
|
||||
expect(env.GOMEMLIMIT).toBe("3GiB");
|
||||
});
|
||||
@@ -77,11 +86,41 @@ describe("local-heavy-check-runtime", () => {
|
||||
it("keeps local tsgo at full speed on roomy hosts in auto mode", () => {
|
||||
const { args, env } = applyLocalTsgoPolicy([], makeEnv(), ROOMY_HOST);
|
||||
|
||||
expect(args).toEqual(["--declaration", "false"]);
|
||||
expect(args).toEqual([
|
||||
"--declaration",
|
||||
"false",
|
||||
"--incremental",
|
||||
"--tsBuildInfoFile",
|
||||
".artifacts/tsgo-cache/root.tsbuildinfo",
|
||||
]);
|
||||
expect(env.GOGC).toBeUndefined();
|
||||
expect(env.GOMEMLIMIT).toBeUndefined();
|
||||
});
|
||||
|
||||
it("uses the configured local tsgo build info file", () => {
|
||||
const { args } = applyLocalTsgoPolicy(
|
||||
[],
|
||||
makeEnv({
|
||||
OPENCLAW_TSGO_BUILD_INFO_FILE: ".artifacts/custom/tsgo.tsbuildinfo",
|
||||
}),
|
||||
ROOMY_HOST,
|
||||
);
|
||||
|
||||
expect(args).toEqual([
|
||||
"--declaration",
|
||||
"false",
|
||||
"--incremental",
|
||||
"--tsBuildInfoFile",
|
||||
".artifacts/custom/tsgo.tsbuildinfo",
|
||||
]);
|
||||
});
|
||||
|
||||
it("avoids incremental cache reuse for ad hoc tsgo runs", () => {
|
||||
const { args } = applyLocalTsgoPolicy(["--extendedDiagnostics"], makeEnv(), ROOMY_HOST);
|
||||
|
||||
expect(args).toEqual(["--extendedDiagnostics", "--declaration", "false"]);
|
||||
});
|
||||
|
||||
it("allows forcing the throttled tsgo policy on roomy hosts", () => {
|
||||
const { args, env } = applyLocalTsgoPolicy(
|
||||
[],
|
||||
@@ -91,7 +130,16 @@ describe("local-heavy-check-runtime", () => {
|
||||
ROOMY_HOST,
|
||||
);
|
||||
|
||||
expect(args).toEqual(["--declaration", "false", "--singleThreaded", "--checkers", "1"]);
|
||||
expect(args).toEqual([
|
||||
"--declaration",
|
||||
"false",
|
||||
"--incremental",
|
||||
"--tsBuildInfoFile",
|
||||
".artifacts/tsgo-cache/root.tsbuildinfo",
|
||||
"--singleThreaded",
|
||||
"--checkers",
|
||||
"1",
|
||||
]);
|
||||
expect(env.GOGC).toBe("30");
|
||||
expect(env.GOMEMLIMIT).toBe("3GiB");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user