release-macos-runtime-closure.test.mjs
42 lines 2.3 KB
Raw
sha256:c88bf098b52c796e46edc39ec71f9f0627d305439b73972d3fada73cefde0da9 fix: put release binaries before lipo architecture checks Human minor ⚠ breaking 25 days ago
1 import assert from 'node:assert/strict';
2 import fs from 'node:fs';
3 import test from 'node:test';
4
5 const runtimePackage = JSON.parse(fs.readFileSync('companion/runtime/package.json', 'utf8'));
6 const runtimeLock = JSON.parse(fs.readFileSync('companion/runtime/package-lock.json', 'utf8'));
7 const releaseLock = JSON.parse(fs.readFileSync('release/macos/release-lock.json', 'utf8'));
8 const runtimeFiles = JSON.parse(fs.readFileSync('release/macos/runtime-files.json', 'utf8'));
9
10 test('standalone dependency roots resolve exactly in the dedicated lock', () => {
11 assert.equal(runtimePackage.engines.node, '24.21.0');
12 assert.equal(runtimePackage.engines.npm, releaseLock.node.npmVersion);
13 for (const [name, version] of Object.entries(runtimePackage.dependencies)) {
14 assert.equal(runtimeLock.packages[`node_modules/${name}`]?.version, version, name);
15 }
16 assert.equal(runtimeLock.packages['node_modules/onnxruntime-web'].version, releaseLock.runtime.onnxruntimeWeb);
17 assert.equal(runtimeLock.packages['node_modules/onnxruntime-common'].version, releaseLock.runtime.onnxruntimeCommon);
18 assert.match(releaseLock.model.w3BundleDigest, /^[0-9a-f]{64}$/);
19 assert.ok(releaseLock.runtime.files.length >= 7);
20 });
21
22 test('Node and every model file have immutable HTTPS, size, and SHA-256 pins', () => {
23 assert.match(releaseLock.node.url, /^https:\/\/nodejs\.org\//);
24 assert.match(releaseLock.node.sha256, /^[0-9a-f]{64}$/);
25 assert.ok(releaseLock.model.files.length >= 7);
26 for (const file of releaseLock.model.files) {
27 assert.match(file.url, /^https:\/\/huggingface\.co\//);
28 assert.match(file.sha256, /^[0-9a-f]{64}$/);
29 assert.ok(Number.isSafeInteger(file.bytes) && file.bytes > 0);
30 }
31 });
32
33 test('native-image dependencies are explicitly excluded from the final web-WASM runtime', () => {
34 assert.ok(runtimeFiles.excludedDependencyNames.includes('sharp'));
35 assert.ok(runtimeFiles.excludedDependencyNames.some((name) => name.includes('libvips')));
36 const build = fs.readFileSync('scripts/release/macos/build.sh', 'utf8');
37 assert.match(build, /excluded sharp\/libvips dependency entered runtime closure/);
38 assert.doesNotMatch(build, /--omit=optional/);
39 assert.match(build, /argon2\/prebuilds/);
40 assert.match(build, /sqlite-vec-darwin-arm64\/vec0\.dylib/);
41 assert.match(build, /verify-module-closure\.mjs/);
42 });
File History 1 commit
sha256:c88bf098b52c796e46edc39ec71f9f0627d305439b73972d3fada73cefde0da9 fix: put release binaries before lipo architecture checks Human minor ⚠ 25 days ago