test: skip symlink fixtures where the host cannot create symlinks (#9566)
Co-authored-by: Claude Code <[email protected]>
This commit is contained in:
1 parent
4701041eef
commit
30f128faba
20 files changed
+1006
-873
No files matched your search
@@ -87,6 +87,7 @@ import {
|
||||
} from "./build-desktop-artifact.ts";
|
||||
import { BRAND_ASSET_PATHS } from "./lib/brand-assets.ts";
|
||||
import { HostProcessArchitecture, HostProcessPlatform } from "@t3tools/shared/hostProcess";
|
||||
import { symlinksSupported } from "@t3tools/shared/testing/symlinks";
|
||||
|
||||
// A minimal stand-in for the staged sidecar roots packed into the WSL archive.
|
||||
const stageWslRuntimeTreeFixture = Effect.fn("stageWslRuntimeTreeFixture")(function* (
|
||||
@@ -2191,7 +2192,7 @@ it("keeps the prefix of a UNC path instead of going relative", () => {
|
||||
assert.deepStrictEqual(paths[0], "\\\\server\\share\\tmp\\node_modules");
|
||||
});
|
||||
|
||||
it.effect("rebases packaged links into the isolated tree", () =>
|
||||
it.effect.skipIf(!symlinksSupported)("rebases packaged links into the isolated tree", () =>
|
||||
Effect.gen(function* () {
|
||||
const fs = yield* FileSystem.FileSystem;
|
||||
const path = yield* Path.Path;
|
||||
|
||||
@@ -7,6 +7,7 @@ import * as Path from "effect/Path";
|
||||
import { HttpClient, HttpRouter } from "effect/unstable/http";
|
||||
|
||||
import { makeMockUpdateRouteLayer } from "./mock-update-server.ts";
|
||||
import { symlinksSupported } from "@t3tools/shared/testing/symlinks";
|
||||
|
||||
const withMockUpdateServer = <A, E, R>(rootRealPath: string, effect: Effect.Effect<A, E, R>) =>
|
||||
effect.pipe(
|
||||
@@ -72,35 +73,37 @@ it.layer(NodeServices.layer)("mock-update-server", (it) => {
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("rejects symlinked files that escape the configured root", () =>
|
||||
Effect.gen(function* () {
|
||||
const fileSystem = yield* FileSystem.FileSystem;
|
||||
const path = yield* Path.Path;
|
||||
const root = yield* fileSystem.makeTempDirectoryScoped({
|
||||
prefix: "mock-update-server-root-",
|
||||
});
|
||||
const outside = yield* fileSystem.makeTempDirectoryScoped({
|
||||
prefix: "mock-update-server-outside-",
|
||||
});
|
||||
const rootRealPath = yield* fileSystem.realPath(root);
|
||||
const outsideFile = path.join(outside, "outside.yml");
|
||||
const linksDir = path.join(root, "links");
|
||||
const symlinkPath = path.join(linksDir, "outside.yml");
|
||||
it.effect.skipIf(!symlinksSupported)(
|
||||
"rejects symlinked files that escape the configured root",
|
||||
() =>
|
||||
Effect.gen(function* () {
|
||||
const fileSystem = yield* FileSystem.FileSystem;
|
||||
const path = yield* Path.Path;
|
||||
const root = yield* fileSystem.makeTempDirectoryScoped({
|
||||
prefix: "mock-update-server-root-",
|
||||
});
|
||||
const outside = yield* fileSystem.makeTempDirectoryScoped({
|
||||
prefix: "mock-update-server-outside-",
|
||||
});
|
||||
const rootRealPath = yield* fileSystem.realPath(root);
|
||||
const outsideFile = path.join(outside, "outside.yml");
|
||||
const linksDir = path.join(root, "links");
|
||||
const symlinkPath = path.join(linksDir, "outside.yml");
|
||||
|
||||
yield* fileSystem.writeFileString(outsideFile, "version: outside\n");
|
||||
yield* fileSystem.makeDirectory(linksDir, { recursive: true });
|
||||
yield* fileSystem.symlink(outsideFile, symlinkPath);
|
||||
yield* fileSystem.writeFileString(outsideFile, "version: outside\n");
|
||||
yield* fileSystem.makeDirectory(linksDir, { recursive: true });
|
||||
yield* fileSystem.symlink(outsideFile, symlinkPath);
|
||||
|
||||
yield* withMockUpdateServer(
|
||||
rootRealPath,
|
||||
Effect.gen(function* () {
|
||||
const client = yield* HttpClient.HttpClient;
|
||||
const response = yield* client.get("/links/outside.yml");
|
||||
yield* withMockUpdateServer(
|
||||
rootRealPath,
|
||||
Effect.gen(function* () {
|
||||
const client = yield* HttpClient.HttpClient;
|
||||
const response = yield* client.get("/links/outside.yml");
|
||||
|
||||
assert.equal(response.status, 404);
|
||||
assert.equal(yield* response.text, "Not Found");
|
||||
}),
|
||||
);
|
||||
}),
|
||||
assert.equal(response.status, 404);
|
||||
assert.equal(yield* response.text, "Not Found");
|
||||
}),
|
||||
);
|
||||
}),
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user