Something went wrong. Try again.
Something went wrong. Try again.
1.6 kB · 27 lines
TypeScript
at main
12345678910111213141516171819202122232425262728import { describe, expect, it } from "vitest";import { spawnSync } from "node:child_process";import { readFileSync } from "node:fs";import { resolve } from "node:path";import { pinnedChromePath, pinnedVersion, realChromePathDeps } from "../../tools/chromePath";import { parseConfig } from "../../shared/config";
const root = resolve(__dirname, "../..");
describe("the pinned Chrome (P1-6.c)", () => { it("is installed, and it is exactly the version package.json pins", () => { const path = pinnedChromePath(root, realChromePathDeps(root)); const version = pinnedVersion(readFileSync(resolve(root, "package.json"), "utf8")); expect(spawnSync(path, ["--version"], { encoding: "utf8" }).stdout.trim()).toBe(`Google Chrome for Testing ${version}`); }); it("`npm run chrome:path` prints it", () => { const r = spawnSync("npm", ["run", "--silent", "chrome:path"], { cwd: root, encoding: "utf8" }); expect(r.status, `exit ${r.status}; stderr: ${r.stderr}; stdout: ${String(r.stdout).slice(0, 300)}`).toBe(0); expect(r.stdout.trim()).toBe(pinnedChromePath(root, realChromePathDeps(root))); }); it("the example config in the repository is a valid config, and names the pinned Chrome", () => { const text = JSON.parse(readFileSync(resolve(root, "aite.config.example.json"), "utf8")); expect(() => parseConfig(text)).not.toThrow(); const version = pinnedVersion(readFileSync(resolve(root, "package.json"), "utf8")); expect(Object.values(text.profiles as Record<string, { chrome: string }>).every((p) => p.chrome.includes(`linux-${version}`))).toBe(true); });});