Skip to content

Commit 6799120

Browse files
committed
test: stabilize develop branch regression checks
1 parent 43e1cad commit 6799120

3 files changed

Lines changed: 22 additions & 7 deletions

File tree

packages/server/src/__tests__/git/cli.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ describe("runGitCheckout", () => {
973973
const result = await runGitCheckout(testDir, "feature/worktree-branch");
974974

975975
expect(result.success).toBe(false);
976-
expect(result.message).toContain("already used by worktree");
976+
expect(result.message).toMatch(/already (?:used by worktree|checked out at)/);
977977
expect(result.message).toContain(linkedWorktreeDir);
978978
} finally {
979979
await rm(linkedWorktreeDir, { recursive: true, force: true });

packages/server/src/__tests__/server-runtime-config.test.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { existsSync, mkdtempSync, rmSync } from "node:fs";
2-
import { homedir, tmpdir } from "node:os";
2+
import { tmpdir } from "node:os";
33
import { join } from "node:path";
44
import { getRuntimePath, readRuntimeConfig } from "@coder-studio/core/runtime";
55
import { afterEach, beforeEach, describe, expect, it } from "vitest";
@@ -9,7 +9,10 @@ import { createServer, type Server, type ServerRuntimeOptions } from "../server.
99
describe("server runtime config", () => {
1010
const originalHome = process.env.HOME;
1111
const originalUserProfile = process.env.USERPROFILE;
12+
const originalRuntimeDir = process.env.CODER_STUDIO_RUNTIME_DIR;
13+
const originalRuntimePath = process.env.CODER_STUDIO_RUNTIME_JSON_PATH;
1214
let testHomeDir: string;
15+
let runtimePath: string;
1316
let server: Server | undefined;
1417

1518
const createRuntimeServer = async (
@@ -20,6 +23,9 @@ describe("server runtime config", () => {
2023
testHomeDir = mkdtempSync(join(tmpdir(), "cs-server-runtime-home-"));
2124
process.env.HOME = testHomeDir;
2225
process.env.USERPROFILE = testHomeDir;
26+
runtimePath = join(testHomeDir, ".coder-studio", "runtime.json");
27+
delete process.env.CODER_STUDIO_RUNTIME_DIR;
28+
process.env.CODER_STUDIO_RUNTIME_JSON_PATH = runtimePath;
2329
});
2430

2531
afterEach(async () => {
@@ -28,7 +34,6 @@ describe("server runtime config", () => {
2834
server = undefined;
2935
}
3036

31-
const runtimePath = join(homedir(), ".coder-studio", "runtime.json");
3237
if (existsSync(runtimePath)) {
3338
rmSync(runtimePath);
3439
}
@@ -46,6 +51,18 @@ describe("server runtime config", () => {
4651
} else {
4752
process.env.USERPROFILE = originalUserProfile;
4853
}
54+
55+
if (originalRuntimeDir === undefined) {
56+
delete process.env.CODER_STUDIO_RUNTIME_DIR;
57+
} else {
58+
process.env.CODER_STUDIO_RUNTIME_DIR = originalRuntimeDir;
59+
}
60+
61+
if (originalRuntimePath === undefined) {
62+
delete process.env.CODER_STUDIO_RUNTIME_JSON_PATH;
63+
} else {
64+
process.env.CODER_STUDIO_RUNTIME_JSON_PATH = originalRuntimePath;
65+
}
4966
});
5067

5168
it("writes runtime config on startup and clears it on stop", async () => {
@@ -62,9 +79,7 @@ describe("server runtime config", () => {
6279
pid: process.pid,
6380
})
6481
);
65-
expect(getRuntimePath()).toBe(
66-
process.env.CODER_STUDIO_RUNTIME_JSON_PATH ?? join(homedir(), ".coder-studio", "runtime.json")
67-
);
82+
expect(getRuntimePath()).toBe(runtimePath);
6883

6984
await server.stop();
7085
server = undefined;

packages/web/src/shells/mobile-shell/index.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ describe("MobileShell Phase 2 workspace", () => {
807807

808808
return undefined;
809809
});
810-
renderMobileShell({
810+
const { store } = renderMobileShell({
811811
initialEntry: "/workspace",
812812
sessions: [],
813813
paneLayout: {

0 commit comments

Comments
 (0)