Feature Request: Make PocketIC Server TTL configurable to support watch mode
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10
- Forks
- 13
- Avg merge
- 4h 41m
- Merged PRs (30d)
- 1
Description
Problem:
The PocketIC server currently has a hardcoded idle timeout. While this is great for preventing orphaned processes in single-run CI environments, it makes the library difficult to use in a standard local development workflow with --watch mode (e.g., vitest --watch)
If a developer is using a globalSetup file to start a single server instance for the test run, the server will shut down after a minute of inactivity. When the developer saves a file to trigger a re-run, the tests fail with an ECONNREFUSED error because the server is no longer running.
Steps to Reproduce:
- Configure Vitest to use a
globalSetupfile that callsPocketIcServer.start(). - Run
vitest --watch. The first run succeeds. - Wait for ~90 seconds without saving any files.
- Save a test file to trigger a re-run.
- The test run fails because it cannot connect to the server.
Proposed Solution:
Expose a configuration option in the PocketIcServer.start() method to control the idle timeout. For example:
await PocketIcServer.start({
// Allow setting the TTL in milliseconds.
// A value of 0 or null could disable the timeout entirely.
ttl: 3_600_000, // 1 hour
});
This would be a non-breaking change that would significantly improve the developer experience for local testing.
Current Workaround:
Not using watch mode and just triggering test manually.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the TypeScript PocketIcServer.start() entry point and trace where the server's idle timeout is configured. Add the proposed TTL option and cover the configured timeout behavior, including the disabled-timeout case, with tests; done means watch-mode reruns remain connected after inactivity.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience, testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100