test(host): cover the non-Error late-conflict wrap
This commit is contained in:
@@ -78,6 +78,19 @@ describe('directory-picker-native client half', () => {
|
|||||||
// surfaced the conflict on the fail-loud channel — no partial mix.
|
// surfaced the conflict on the fail-loud channel — no partial mix.
|
||||||
for (const hole of HOLES) expect(b.slots.entries(hole)).toHaveLength(1)
|
for (const hole of HOLES) expect(b.slots.entries(hole)).toHaveLength(1)
|
||||||
expect(rejections.map(String).join('\n')).toContain('already has a registration')
|
expect(rejections.map(String).join('\n')).toContain('already has a registration')
|
||||||
|
|
||||||
|
// Non-Error conflicts wrap before the loud rethrow (same channel).
|
||||||
|
const c = await bench()
|
||||||
|
await c.ctx.plugin({ inject: [...inject], apply }).await()
|
||||||
|
const original = c.slots.register.bind(c.slots)
|
||||||
|
const slotsAny = c.slots as { register: typeof original }
|
||||||
|
slotsAny.register = ((options: never, component: never) => {
|
||||||
|
if ((options as { name?: string }).name === HOLES[0]) throw 'string conflict'
|
||||||
|
return original(options, component)
|
||||||
|
}) as typeof original
|
||||||
|
c.declare()
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 20))
|
||||||
|
expect(rejections.map(String).join('\n')).toContain('string conflict')
|
||||||
} finally {
|
} finally {
|
||||||
process.off('unhandledRejection', onUnhandled)
|
process.off('unhandledRejection', onUnhandled)
|
||||||
process.off('uncaughtException', onUnhandled)
|
process.off('uncaughtException', onUnhandled)
|
||||||
|
|||||||
Reference in New Issue
Block a user