test-utils
test-utils copied to clipboard
registerEndpoint fails to register on deep paths
Environment
- Operating System: Linux
- Node Version: v18.20.3
- Nuxt Version: 3.13.2
- CLI Version: 3.13.2
- Nitro Version: 2.9.7
- Package Manager: [email protected]
- Builder: -
- User Config: compatibilityDate, devtools
- Runtime Modules: -
- Build Modules: -
Reproduction
https://stackblitz.com/edit/nuxt-starter-fvrlkg?file=tests/app.test.ts,app.vue
cancel the running process in the terminal and run npm test - you will see the failure.
Describe the bug
It seems that when registerEndpoint is called on a path containing two levels deep such as /api/foo, then subsequent calls to registerEndpoint on paths containing that root will fail to register. Ie, registerEndpoint('/api/foo/bar', ...) will silently fail. Calls to that deeper path when run in the test context receive the shorter path's response.
Additional context
No response
Logs
No response