GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — t3code/scripts/resolve-nightly-release.test.ts at main · SivanTechDev/t3code

Expand file tree

/

resolve-nightly-release.test.ts

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
122 lines (107 loc) · 4.86 KB
/

resolve-nightly-release.test.ts

Copy path

File metadata and controls

122 lines (107 loc) · 4.86 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import * as NodeServices from "@effect/platform-node/NodeServices";
import { assert, it } from "@effect/vitest";
import * as Config from "effect/Config";
import * as ConfigProvider from "effect/ConfigProvider";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Path from "effect/Path";
import * as PlatformError from "effect/PlatformError";
import {
readDesktopBaseVersion,
resolveNightlyBaseVersion,
resolveNightlyReleaseMetadata,
resolveNightlyTargetVersion,
writeNightlyReleaseOutput,
} from "./resolve-nightly-release.ts";
it("strips prerelease and build metadata when deriving the nightly base version", () => {
assert.equal(resolveNightlyBaseVersion("0.0.17"), "0.0.17");
assert.equal(resolveNightlyBaseVersion("9.9.9-smoke.0"), "9.9.9");
assert.equal(resolveNightlyBaseVersion("1.2.3-beta.4+build.9"), "1.2.3");
});
it.effect("bumps the patch version before deriving nightly prerelease versions", () =>
Effect.gen(function* () {
assert.equal(yield* resolveNightlyTargetVersion("0.0.17"), "0.0.18");
assert.equal(yield* resolveNightlyTargetVersion("9.9.9-smoke.0"), "9.9.10");
assert.equal(yield* resolveNightlyTargetVersion("1.2.3-beta.4+build.9"), "1.2.4");
}),
);
it.effect("reports the invalid desktop package version", () =>
Effect.gen(function* () {
const error = yield* resolveNightlyTargetVersion("nightly").pipe(Effect.flip);
assert.equal(error._tag, "InvalidDesktopPackageVersionError");
assert.equal(error.version, "nightly");
assert.equal(error.message, "Invalid desktop package version 'nightly'.");
}),
);
it("derives nightly metadata including the short commit sha in the release name", () => {
assert.deepStrictEqual(
resolveNightlyReleaseMetadata("9.9.10", "20260413", 321, "abcdef1234567890"),
{
baseVersion: "9.9.10",
version: "9.9.10-nightly.20260413.321",
tag: "v9.9.10-nightly.20260413.321",
name: "T3 Code Nightly 9.9.10-nightly.20260413.321 (abcdef123456)",
shortSha: "abcdef123456",
},
);
});
it.effect("preserves the GITHUB_OUTPUT configuration cause", () => {
const metadata = resolveNightlyReleaseMetadata("1.2.4", "20260620", 42, "abcdef1234567890");
const configCause = new ConfigProvider.SourceError({ message: "environment unavailable" });
return Effect.gen(function* () {
const configError = yield* writeNightlyReleaseOutput(metadata, true).pipe(
Effect.provideService(FileSystem.FileSystem, FileSystem.makeNoop({})),
Effect.provideService(
ConfigProvider.ConfigProvider,
ConfigProvider.make(() => Effect.fail(configCause)),
),
Effect.flip,
);
if (configError._tag !== "NightlyReleaseGitHubOutputConfigError") {
return assert.fail(`Unexpected error: ${configError._tag}`);
}
assert.instanceOf(configError.cause, Config.ConfigError);
assert.strictEqual(configError.cause.cause, configCause);
assert.notInclude(configError.message, configCause.message);
});
});
it.layer(NodeServices.layer)("readDesktopBaseVersion", (it) => {
it.effect("preserves desktop package read context and its platform cause", () =>
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const rootDir = yield* fs.makeTempDirectoryScoped({
prefix: "resolve-nightly-release-read-",
});
const packageJsonPath = path.join(rootDir, "apps/desktop/package.json");
const error = yield* readDesktopBaseVersion(rootDir).pipe(Effect.flip);
if (error._tag !== "NightlyReleaseDesktopPackageError") {
return assert.fail(`Unexpected error: ${error._tag}`);
}
assert.equal(error.operation, "read");
assert.equal(error.packageJsonPath, packageJsonPath);
assert.instanceOf(error.cause, PlatformError.PlatformError);
assert.notInclude(error.message, String((error.cause as Error).message));
}),
);
it.effect("preserves desktop package decode context and its schema cause", () =>
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const rootDir = yield* fs.makeTempDirectoryScoped({
prefix: "resolve-nightly-release-decode-",
});
const packageJsonPath = path.join(rootDir, "apps/desktop/package.json");
yield* fs.makeDirectory(path.dirname(packageJsonPath), { recursive: true });
yield* fs.writeFileString(packageJsonPath, "{");
const error = yield* readDesktopBaseVersion(rootDir).pipe(Effect.flip);
if (error._tag !== "NightlyReleaseDesktopPackageError") {
return assert.fail(`Unexpected error: ${error._tag}`);
}
assert.equal(error.operation, "decode");
assert.equal(error.packageJsonPath, packageJsonPath);
assert.ok(error.cause !== undefined);
assert.notInclude(error.message, String((error.cause as Error).message));
}),
);
});
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.