Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/core/device-root.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,19 @@ describe("ensureOwnedRoot", () => {
},
);

it("refuses as unreadable a root whose rename failed with another code, ENOSPC, even when another process published it first", async () => {
const filesystem = new RefusingRenameFilesystem(
uid,
async (target) => {
await target.mkdirp(root);
await target.writeFileAtomic(markerPath, marker());
},
"ENOSPC",
);

await expect(refusal(filesystem)).resolves.toBe("unreadable");
});

it("still refuses a root whose rename was refused with EPERM when nothing else published it", async () => {
const filesystem = new RefusingRenameFilesystem(uid, async () => undefined);

Expand Down
2 changes: 2 additions & 0 deletions src/drivers/android/prerequisites.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ describe("androidPrerequisites on Windows", () => {
it.each([
["ANDROID_HOME", { ANDROID_HOME: winSdk }, winSdk],
["Android Studio's %LOCALAPPDATA% default", { LOCALAPPDATA: "/Volumes/Data/Local" }, localSdk],
["<home>/AppData/Local when LOCALAPPDATA is unset", {}, winSdk],
["<home>/AppData/Local when LOCALAPPDATA is empty", { LOCALAPPDATA: "" }, winSdk],
])(
"finds a complete SDK of .exe and .bat tools through %s and runs its sdkmanager.bat",
async (_source, env, root) => {
Expand Down
7 changes: 7 additions & 0 deletions src/ports/paths.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ describe("resolveDaemonSocketPath", () => {
expect(isPipeEndpoint(endpoint)).toBe(true);
});

it("names the pipe simlock- and the first 16 hex characters of the SHA-256 of the lower-cased data directory, as the client docs say", () => {
// why: `printf '%s' 'c:\users\me\.simlock' | shasum -a 256` starts 9b8d70a31742e257.
expect(resolveDaemonSocketPath(home, "win32")).toBe(
String.raw`\\.\pipe\simlock-9b8d70a31742e257`,
);
});

it("gives one data directory one name, whatever its case, and two directories two", () => {
const endpoint = resolveDaemonSocketPath(home, "win32");

Expand Down
18 changes: 15 additions & 3 deletions src/ports/process-supervisor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,23 @@ describe("NodeProcessSupervisor.commandLine", () => {
);

it.each([
["linux", "exits non-zero", "ps", posixRead, { code: 1 }],
["linux", "exits non-zero", "ps", posixRead, { code: 1, stdout: "/usr/bin/node a.js\n" }],
["linux", "prints nothing", "ps", posixRead, { stdout: "\n" }],
["win32", "exits non-zero", "powershell.exe", windowsRead, { code: 1 }],
[
"win32",
"exits non-zero",
"powershell.exe",
windowsRead,
{ code: 1, stdout: "node a.js\r\n" },
],
["win32", "prints nothing", "powershell.exe", windowsRead, { stdout: "\r\n" }],
["win32", "is ended at its time limit", "powershell.exe", windowsRead, { code: null }],
[
"win32",
"is ended at its time limit",
"powershell.exe",
windowsRead,
{ code: null, stdout: "node a.js\r\n" },
],
] as const)(
"answers undefined on %s when the read %s",
async (platform, _case, command, args, result) => {
Expand Down
Loading