···2121 expect(stderr).toContain('invalid diff config file')
2222 expect(stderr).toContain('Must have a default export with config object')
2323})
2424+2525+// https://github.com/vitest-dev/vitest/issues/8663
2626+// An inline `diff` object may carry non-serializable color functions. They must
2727+// be stripped before the config is sent to workers, otherwise the `threads`
2828+// pool throws a `DataCloneError` (structured clone) and the `forks` pool drops
2929+// them over IPC. The serializable annotations must still be applied.
3030+test.each(['forks', 'threads'] as const)(
3131+ 'inline diff config object with color functions works in %s pool',
3232+ async (pool) => {
3333+ const filename = resolve('./fixtures/reporters/custom-diff-config.test.ts')
3434+ const { stderr } = await runVitest({
3535+ root: './fixtures/reporters',
3636+ pool,
3737+ diff: {
3838+ aAnnotation: 'Expected to be',
3939+ bAnnotation: 'But got',
4040+ // @ts-expect-error color functions are not part of the public diff type,
4141+ // but users pass them at runtime — this is what used to crash the worker.
4242+ aColor: (s: string) => s,
4343+ },
4444+ }, [filename])
4545+4646+ expect(stderr).not.toContain('could not be cloned')
4747+ expect(stderr).not.toContain('DataCloneError')
4848+ expect(stderr).toContain('Expected to be')
4949+ expect(stderr).toContain('But got')
5050+ },
5151+)