mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
test(docker): cover browser install build arg
This commit is contained in:
23
src/dockerfile.test.ts
Normal file
23
src/dockerfile.test.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const repoRoot = resolve(fileURLToPath(new URL(".", import.meta.url)), "..");
|
||||
const dockerfilePath = join(repoRoot, "Dockerfile");
|
||||
|
||||
describe("Dockerfile", () => {
|
||||
it("installs optional browser dependencies after pnpm install", async () => {
|
||||
const dockerfile = await readFile(dockerfilePath, "utf8");
|
||||
const installIndex = dockerfile.indexOf("RUN pnpm install --frozen-lockfile");
|
||||
const browserArgIndex = dockerfile.indexOf("ARG OPENCLAW_INSTALL_BROWSER");
|
||||
|
||||
expect(installIndex).toBeGreaterThan(-1);
|
||||
expect(browserArgIndex).toBeGreaterThan(-1);
|
||||
expect(browserArgIndex).toBeGreaterThan(installIndex);
|
||||
expect(dockerfile).toContain(
|
||||
"node /app/node_modules/playwright-core/cli.js install --with-deps chromium",
|
||||
);
|
||||
expect(dockerfile).toContain("apt-get install -y --no-install-recommends xvfb");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user