Skip to content

Commit c64afd7

Browse files
author
Zayd
committed
test(build): guard artifact symlink checks by host capability
1 parent 9c025c3 commit c64afd7

1 file changed

Lines changed: 24 additions & 5 deletions

File tree

‎scripts/build-desktop-artifact.test.ts‎

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,22 +1684,41 @@ it.effect("preserves packaged app directories from the dir target", () =>
16841684
yield* fs.makeDirectory(path.join(stage, app), { recursive: true });
16851685
yield* fs.writeFileString(path.join(stage, app, "Info.plist"), "built-app");
16861686
yield* fs.writeFileString(path.join(stage, "builder-debug.yml"), "debug");
1687-
yield* fs.symlink("Info.plist", path.join(stage, app, "Current"));
16881687
const copied = yield* copyDesktopBuildArtifacts(stage, output, true);
16891688
assert.include(copied, path.join(output, "mac-arm64"));
16901689
assert.equal(yield* fs.readFileString(path.join(output, app, "Info.plist")), "built-app");
1691-
assert.equal(yield* fs.readLink(path.join(output, app, "Current")), "Info.plist");
16921690
assert.equal(yield* fs.readFileString(path.join(stage, app, "Info.plist")), "built-app");
16931691
yield* fs.remove(path.join(stage, app, "Info.plist"));
1694-
yield* fs.remove(path.join(stage, app, "Current"));
16951692
yield* fs.writeFileString(path.join(stage, app, "New.plist"), "rebuilt-app");
1696-
yield* fs.symlink("New.plist", path.join(stage, app, "Current"));
16971693
yield* copyDesktopBuildArtifacts(stage, output, true);
16981694
assert.isFalse(yield* fs.exists(path.join(output, app, "Info.plist")));
16991695
assert.equal(yield* fs.readFileString(path.join(output, app, "New.plist")), "rebuilt-app");
1700-
assert.equal(yield* fs.readLink(path.join(output, app, "Current")), "New.plist");
17011696
const filesOnly = yield* copyDesktopBuildArtifacts(stage, path.join(root, "files-only"));
17021697
assert.deepEqual(filesOnly, [path.join(root, "files-only", "builder-debug.yml")]);
17031698
assert.isFalse(yield* fs.exists(path.join(root, "files-only", "mac-arm64")));
17041699
}).pipe(Effect.provide(NodeServices.layer), Effect.scoped),
17051700
);
1701+
1702+
it.effect.skipIf(!symlinksSupported)("preserves relative links when replacing dir artifacts", () =>
1703+
Effect.gen(function* () {
1704+
const fs = yield* FileSystem.FileSystem;
1705+
const path = yield* Path.Path;
1706+
const root = yield* fs.makeTempDirectoryScoped({ prefix: "t3-dir-artifact-links-" });
1707+
const stage = path.join(root, "stage");
1708+
const output = path.join(root, "output");
1709+
const app = path.join("mac-arm64", "T3 Code.app", "Contents");
1710+
yield* fs.makeDirectory(path.join(stage, app), { recursive: true });
1711+
yield* fs.writeFileString(path.join(stage, app, "Info.plist"), "built-app");
1712+
yield* fs.symlink("Info.plist", path.join(stage, app, "Current"));
1713+
yield* copyDesktopBuildArtifacts(stage, output, true);
1714+
assert.equal(yield* fs.readLink(path.join(output, app, "Current")), "Info.plist");
1715+
assert.equal(yield* fs.readFileString(path.join(output, app, "Current")), "built-app");
1716+
1717+
yield* fs.remove(path.join(stage, app, "Current"));
1718+
yield* fs.writeFileString(path.join(stage, app, "New.plist"), "rebuilt-app");
1719+
yield* fs.symlink("New.plist", path.join(stage, app, "Current"));
1720+
yield* copyDesktopBuildArtifacts(stage, output, true);
1721+
assert.equal(yield* fs.readLink(path.join(output, app, "Current")), "New.plist");
1722+
assert.equal(yield* fs.readFileString(path.join(output, app, "Current")), "rebuilt-app");
1723+
}).pipe(Effect.provide(NodeServices.layer), Effect.scoped),
1724+
);

0 commit comments

Comments
 (0)