Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
`state_descriptors_fixed` error when testing writable with nested data structure and Immer | GoodFirstPicks

`state_descriptors_fixed` error when testing writable with nested data structure and Immer

sveltejs/svelte 0 comments 28d ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeTest focusedSvelteTypeScript

Why this is a good first issue

The issue involves a specific error when testing nested data structures with Immer in Svelte.

AI Summary

The issue occurs when testing nested data structures passed as props in Svelte with Immer, resulting in a `state_descriptors_fixed` error. The problem is reproducible in a test environment but not in the browser. The issue requires understanding both Svelte's state management and Immer's integration.

Issue Description

Describe the bug

state_descriptors_fixed error updating nested data passed as props from test in conjunction with immer

Reproduction

Reproduction repo link The repository includes a the immer library to make it easier to work with immutable data. The tests demonstrate the issue when passing a nested data structure to a Page component, and then attempting to update it using a callback method that's activated by a button in the component.

There are two tests in the repo:

  • update the data with Immer
  • update the data without Immer

The second one passes. Both buttons cause no issues when I test them manually in my browser (I am using Vivaldi, which is Chrome based).

If the nested field is removed, I no longer see those errors in the tests.

Logs

> [email protected] test
> npm run test:unit -- --run


> [email protected] test:unit
> vitest --run


 RUN  v3.0.7 /home/alter_kaker/code/test-error

stderr | src/routes/tests/page.svelte.test.ts > immer
Error: Uncaught [Svelte error: state_descriptors_fixed
Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.
https://svelte.dev/e/state_descriptors_fixed]
    at reportException (/home/alter_kaker/code/test-error/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:66:24)
    at innerInvokeEventListeners (/home/alter_kaker/code/test-error/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:353:9)
    at invokeEventListeners (/home/alter_kaker/code/test-error/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:286:3)
    at HTMLButtonElementImpl._dispatch (/home/alter_kaker/code/test-error/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:233:9)
    at HTMLButtonElementImpl.dispatchEvent (/home/alter_kaker/code/test-error/node_modules/jsdom/lib/jsdom/living/events/E

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 15 points when you complete it!

Risk Flags

  • requires understanding of Svelte internals
  • involves third-party library (Immer)
Loading labels...

Details

Points15 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedyes