fix(vitest): strip non-serializable functions from inline diff config by DucMinhNe · Pull Request #10573 · vitest-dev/vitest (original) (raw)

added 2 commits

June 11, 2026 09:37

@DucMinhNe

An inline test.diff object can carry color/compareKeys functions (DiffOptions). serializeConfig forwarded the raw object to the worker pool, so the config failed to cross the worker boundary: the threads pool threw DataCloneError on structured clone and the forks pool threw on child_process IPC serialization. Every run with an inline diff object that included a color function crashed the worker.

Forward only the serializable fields declared by SerializedDiffOptions, matching the existing contract (the file-path form still imports the function-based options locally in the worker).

Fixes vitest-dev#8663

@DucMinhNe

The previous commit returned every SerializedDiffOptions field, so unset options became explicit undefined values that clobbered the diff defaults when the worker merged the options — breaking inline options like { expand: true } and { printBasicPrototype: true } (caught by test/diff.test.ts in CI). Copy only the keys that are actually set.

sheremet-va

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})