25 lines
1.5 KiB
JavaScript
25 lines
1.5 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { readFile } from "node:fs/promises";
|
|
import test from "node:test";
|
|
|
|
test("bun-command artifact Dockerfile installs native Bun binary without npm postinstall", async () => {
|
|
const source = await readFile("scripts/artifact-publish.mjs", "utf8");
|
|
assert.match(source, /@oven\/bun-linux-x64@1\.3\.13/u);
|
|
assert.match(source, /@oven\/bun-linux-aarch64@1\.3\.13/u);
|
|
assert.match(source, /--ignore-scripts "\$bun_pkg"/u);
|
|
assert.match(source, /ln -sf "\/app\/node_modules\/\\\$\{bun_pkg%@\*\}\/bin\/bun" \/usr\/local\/bin\/bun/u);
|
|
assert.doesNotMatch(source, /npm install --no-save --omit=dev --include=optional --ignore-scripts bun@/u);
|
|
assert.match(source, /hwlab-artifact-runtime-check-failed:\$1/u);
|
|
assert.match(source, /fail bun-version/u);
|
|
});
|
|
|
|
test("env-reuse Dockerfile carries git and stable Bun path for mirror checkout", async () => {
|
|
const source = await readFile("scripts/artifact-publish.mjs", "utf8");
|
|
assert.ok(source.includes("apt-get install -y --no-install-recommends ca-certificates git"));
|
|
assert.ok(source.includes('ln -sf \\"/opt/hwlab-env/$bun_bin\\" /usr/local/bin/bun'));
|
|
assert.ok(source.includes("test -x /usr/local/bin/bun"));
|
|
assert.ok(source.includes("/usr/local/bin/bun --version >/tmp/hwlab-env-bun-version.txt"));
|
|
assert.ok(source.includes("ENV PATH=/usr/local/bin:$PATH"));
|
|
assert.ok(source.includes('CMD [\\"/usr/local/bin/bun\\", \\"/usr/local/bin/hwlab-env-reuse-launcher.ts\\"]'));
|
|
});
|