Skip to content

Commit 59cbf4f

Browse files
committed
fix(test): copy the builder configuration through JSON
The contract test isolates a configuration copy per packager because electron-builder rewrites the object it is handed. structuredClone did that locally on Node 26 and failed on the Node 24 the CI lane runs: "Unable to deserialize cloned data due to invalid or unsupported version". Everything electron-builder reads out of this configuration has to survive serialization anyway, and JSON round-tripping behaves the same on every version. `beforePack` is the one function in it and is carried across by reference. Generated-by: Claude Opus 5 via Claude Code
1 parent 53d7a4e commit 59cbf4f

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

scripts/desktop-release-targets.test.mjs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,16 @@ const DESKTOP_PROJECT_DIRECTORY = fileURLToPath(new URL('../apps/desktop', impor
188188
* electron-builder rewrites the configuration object it is handed — `normalizeFiles`
189189
* turns `files` into records in place — and `resolveDesktopBuilderConfig` returns one
190190
* shared module-level object outside the Nightly branch. Packaging calls it once, so
191-
* this only bites a test that builds several packagers. `beforePack` is a function and
192-
* cannot be structured-cloned; it is carried across by reference and never invoked here.
191+
* this only bites a test that builds several packagers.
192+
*
193+
* Copied through JSON rather than `structuredClone`: everything electron-builder reads
194+
* here has to survive serialization anyway, and the structured clone algorithm rejected
195+
* this object on Node 24 while accepting it on 26. `beforePack` is the one function in
196+
* the configuration; it is carried across by reference and never invoked by this test.
193197
*/
194198
function isolatedBuilderConfig() {
195199
const { beforePack, ...rest } = resolveDesktopBuilderConfig({});
196-
return { ...structuredClone(rest), beforePack };
200+
return { ...JSON.parse(JSON.stringify(rest)), beforePack };
197201
}
198202

199203
/**

0 commit comments

Comments
 (0)