Diffinery

codician/diffinerypublic

Open-source, agent-first GitHub and GitHub Actions alternative that runs on your own Cloudflare account: git hosting, pull requests, code review and drop-in GitHub Actions YAML on Workers, Durable Objects, R2 and Containers.

26 lines · 1.4 KBRaw History
1import { readFileSync } from "node:fs";
2import path from "node:path";
3import { describe, expect, it } from "vitest";
4// @ts-expect-error: a plain .mjs build script without type declarations
5import { manifestFor, packageExtension, vsixManifest } from "../scripts/package.mjs";
6
7const pkg = JSON.parse(readFileSync(path.join(__dirname, "../package.json"), "utf8"));
8const updateDefault = (m: typeof pkg): boolean => m.contributes.configuration.properties["diffinery.checkForUpdates"].default;
9
10describe("package.mjs", () => {
11 it("keeps the self-update check on for diffinery.com's build and turns it off for marketplaces", () => {
12 expect(updateDefault(manifestFor(pkg))).toBe(true);
13 expect(updateDefault(manifestFor(pkg, { marketplace: true }))).toBe(false);
14 expect(updateDefault(pkg)).toBe(true);
15 expect(manifestFor(pkg, { marketplace: true })).toMatchObject({ name: "diffinery", publisher: "codician", license: "Apache-2.0" });
16 });
17
18 it("ships the license in both builds", async () => {
19 for (const marketplace of [false, true]) {
20 const { vsix } = await packageExtension({ marketplace });
21 const text = Buffer.from(vsix).toString("latin1");
22 expect(text).toContain("extension/LICENSE.txt");
23 }
24 expect(vsixManifest(manifestFor(pkg))).toContain('<Asset Type="Microsoft.VisualStudio.Services.Content.License" Path="extension/LICENSE.txt" Addressable="true" />');
25 });
26});