-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Routify hangs with vitest #553
Comments
Thanks for the report @yairkukielka I am not able to reproduce it on my end. What happens if you run routify({ render: { ssr: { enable: true } } }), |
Ok, I tried but the test failed :)
I couldn't make it pass. In any case, what you suggested is a different project. Mine doesn't use ssr, it's an SPA. Could you try my example? |
The Tried your code. Seems you're missing <script context="module"> in your Without export const router = createRouter({ routes }); Let me know if this works for you. 😊 |
Hello, thanks for taking a look. Unfortunately that didn't fix it. I replaced
|
I fixed some timing issues related to testing, could you try the following
|
Hello, this isn't using my reproduction example, is it? |
I can't tell if it fixes your example as I couldn't reproduce the error when I ran it. If the commands above work for you, we'll have something to go on in terms of fixing the issue. |
I see. I ran those commands and here's the result:
|
That's great news. You may need to add some or all of this `/** @type { Router } */
let router
beforeAll(async () => {
await import('../.routify/routify-init.js') // fix path if needed
router = globalThis.__routify.routers[0]
await router.ready()
await router.activeRoute.get().rendered
}) |
I added that code to the test as you can see here and it still failed, unfortunately.
From the project created using your command I saw that in the index.html this line
was replaced by this one
I tried this with no avail. Something else I tried: in
with
The test passes but I get the same error as before:
Lastly, I tried with the new vitest 2.0 but I got the same result |
Describe the bug
When running the tests it looks like the process hangs at the end, just after passing the tests.
Reproduction
When running tests with vitest. The issue gets resolved if I remove the routify plugin from the vite config file, so it looks like routify is the culprit. After the Vitest default 10 seconds timout, the process is killed by Vitest
See reproduction example here https://github.com/yairkukielka/routify-vitest-example
Logs
If I add this
to the vite config as the error suggests, I get
The text was updated successfully, but these errors were encountered: