diff --git a/src/packager/packager/build-id.js b/src/packager/packager/build-id.js index e9b5a79977d..0996ae95a4c 100644 --- a/src/packager/packager/build-id.js +++ b/src/packager/packager/build-id.js @@ -1,4 +1,10 @@ -// Set once by the GUI build and shared with every emitted packager runtime. +// Set once by the host build and shared with every emitted packager runtime. import {buildId} from 'virtual:packager-runtime'; -const verifyBuildId = (expectedBuildId, source) => source.endsWith(`${expectedBuildId} =^..^=`); + +// A runtime only carries a build id when the host stamped one on. Development +// builds of the standalone packager do not, and rejecting those would make it +// refuse the scaffolding it just built. +const verifyBuildId = (expectedBuildId, source) => (source.endsWith('=^..^=') ? + source.endsWith(`${expectedBuildId} =^..^=`) : true); + export {buildId, verifyBuildId}; diff --git a/test/unit/packager-export.test.js b/test/unit/packager-export.test.js index e72865c1ac0..ac88d686fe6 100644 --- a/test/unit/packager-export.test.js +++ b/test/unit/packager-export.test.js @@ -40,8 +40,9 @@ test('cancelled project preparation cannot continue into packaging', async () => expect(downloadProject).not.toHaveBeenCalled(); }); -test('runtime validation rejects stale deployments and unversioned scripts', () => { +test('runtime validation rejects stale deployments and accepts unstamped runtimes', () => { expect(verifyBuildId('current', 'runtime code\n// current =^..^=')).toBe(true); expect(verifyBuildId('current', 'runtime code\n// previous =^..^=')).toBe(false); - expect(verifyBuildId('current', 'runtime code')).toBe(false); + // Development builds of the standalone packager do not stamp their runtimes. + expect(verifyBuildId('current', 'runtime code')).toBe(true); });