Files
OmniRoute/tests/unit/build/bun-runtime-native-addon.test.mjs
Nguyễn Viết Tuấn 7b7196f05d fix(docker-bun): strip Node SQLite addon from runtime (#11482)
Validated in a combined 4-PR batch worktree off release/v3.8.51 tip (complements #11468 and #11470, both merged first). Conflicted against #11470's Dockerfile.bun hunk in the shared worktree — resolved additively (both the ownership hardening and the addon-stripping RUN block coexist, ordered so the strip runs as root before USER bun) and pushed the same resolution to this branch.
- Focused test: bun-runtime-native-addon.test.mjs — 1/1 pass, part of batch's 5/5 node:test run
- typecheck:core, file-size, changelog-integrity, complexity, cognitive-complexity — all OK
- Full-repo lint: 228 pre-existing dashboard react-hooks/* findings, unrelated to this diff

Thanks for the isolated-probe root-causing (better-sqlite3 specifically, ruling out keytar/onnxruntime-node/sqlite-vec/tls-client-node/wreq-js/sharp) plus the production ARM64 evidence.
2026-08-25 20:34:05 -03:00

21 lines
650 B
JavaScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
const dockerfile = readFileSync(new URL("../../../Dockerfile.bun", import.meta.url), "utf8");
test("Bun runner excludes every better-sqlite3 native addon", () => {
assert.doesNotMatch(
dockerfile,
/COPY --from=builder \/app\/node_modules\/better-sqlite3/
);
assert.match(
dockerfile,
/find \/app[\s\S]*-path '\*\/node_modules\/better-sqlite3'[\s\S]*-prune[\s\S]*-exec rm -rf '\{\}' \+/
);
assert.match(
dockerfile,
/test -z "\$\(find \/app -type f -name 'better_sqlite3\.node' -print -quit\)"/
);
});