Skip to content

Testing with Router involved (SPA code) #70

Open
@dominikzogg

Description

@dominikzogg

I was upgrading by solid demo repository and got the following

 FAIL  tests/app.test.tsx [ tests/app.test.tsx ]
Error: Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.
 ❯ Module.notSup node_modules/.pnpm/[email protected]/node_modules/solid-js/web/dist/server.js:1136:9
    1134| }
    1135| function notSup() {
    1136|   throw new Error(
       |         ^
    1137|     "Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>."
    1138|   );
 ❯ node_modules/.pnpm/@[email protected][email protected]/node_modules/@solidjs/router/dist/index.js:1636:49
 ❯ tests/app.test.tsx:4:31

My current PR: https://github.com/chubbyts/solid-petstore/pull/3/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519

Code: https://github.com/chubbyts/solid-petstore/blob/vendor-upgrade/src/app.tsx
Test: https://github.com/chubbyts/solid-petstore/blob/vendor-upgrade/tests/app.test.tsx

The code seems to run as before the upgrade (no issue) but any test i wrote related to router has this error message.

To be honest i have no clue if this it the right place to post this, nor if i fucked up in the first place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions