-
Notifications
You must be signed in to change notification settings - Fork 8
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.