Something went wrong. Try again.
Automations and webhooks for the AT Protocol airglow.run
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334import { existsSync, readFileSync } from "node:fs";import { describe, expect, it } from "vitest";import { SSR_EXTERNAL } from "./vite.config.js";
const pkg = JSON.parse(readFileSync("package.json", "utf-8")) as { dependencies: Record<string, string>; devDependencies: Record<string, string>;};const direct = new Set([...Object.keys(pkg.dependencies), ...Object.keys(pkg.devDependencies)]);
function hoisted(): string[] { const lines = readFileSync("pnpm-workspace.yaml", "utf-8").split("\n"); const start = lines.indexOf("publicHoistPattern:"); const entries: string[] = []; for (const line of lines.slice(start + 1)) { const m = line.match(/^ {2}- "?([^"]+)"?$/); if (!m) break; entries.push(m[1]!); } return entries;}
describe("ssr.external", () => { it.each(SSR_EXTERNAL)("%s is a direct dependency or publicly hoisted", (name) => { expect(direct.has(name) || hoisted().includes(name)).toBe(true); });
// Checks the root node_modules itself: a worktree nested in another checkout // would otherwise resolve the package from the parent's node_modules. it.each(SSR_EXTERNAL)("%s is installed in the root node_modules", (name) => { expect(existsSync(`node_modules/${name}/package.json`)).toBe(true); });});