kazupon / kazupon/vite-test-utils
Timeout waiting for port
- Dominant language
- TypeScript
- Stars
- 33
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the bug
Hi
I got this error, how can I solve this problem?
`src/tests/user.spec.ts
Error: Timeout waiting for port 7501 after 32 retries with 500ms interval.
- /node_modules/.pnpm/get-port-please@2.6.1/node_modules/get-port-please/dist/index.mjs:164:9
- /node_modules/.pnpm/vite-test-utils@0.6.0_@types+node@20.3.3/node_modules/vite-test-utils/dist/index.mjs:60:3
- /node_modules/.pnpm/vite-test-utils@0.6.0_@types+node@20.3.3/node_modules/vite-test-utils/dist/index.mjs:146:7
undefined`
code
`
import { setup, $fetch } from 'vite-test-utils';
import { expect, describe, it,test } from 'vitest';
await setup({
// test context options
server: true
});
test('create a todo', async () => {
const form =JSON.stringify({ email: 'alighafoori1357@yahoo.com', password: 'sdwefsdgvvcs', rememberMe: false })
const { todo } = await $fetch('/user/login', {
method: 'POST',
body: form,
headers: {
accept: 'application/json'
}
})
expect(todo).toHaveProperty('uid')
expect(todo).toHaveProperty('created_at')
expect(todo).toContain({ text: 'task1', done: false })
})`
### Reproduction
Reproduction
### System Info
```Shell
System:
OS: Windows 10 10.0.19045
CPU: (4) x64 AMD A6-6310 APU with AMD Radeon R4 Graphics
Memory: 2.78 GB / 10.97 GB
Binaries:
Node: 20.1.0 - C:\Program Files\nodejs\node.EXE
npm: 9.6.7 - C:\Program Files\nodejs\npm.CMD
pnpm: 8.6.3 - ~\AppData\Local\pnpm\pnpm.EXE
Browsers:
Edge: Spartan (44.19041.1266.0), Chromium (114.0.1823.67)
Internet Explorer: 11.0.19041.1566
```
### Used Package Manager
pnpm
### Additional context
_No response_
### Validations
- [X] Follow our [Code of Conduct](https://github.com/kazupon/vite-test-utils/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guide](https://github.com/kazupon/vite-test-utils/blob/main/CONTRIBUTING.md).
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- [X] The provided reproduction is a [minimal reproducible](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
Contributor guide
Research direction
Start with src/tests/user.spec.ts and the setup({ server: true }) call, then inspect the vite-test-utils port-waiting path shown in the stack trace. Reproduce the test on the reported Windows and pnpm setup, identify why port 7501 does not become available, and confirm that the test completes without the timeout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vite
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100