[vitest-pool-workers] Add option to disable automatic main entrypoint import #13233
Replies: 2 comments
-
|
This seems like a great feature (and I've added it to our backlog). Out of interest though, if you're not using the integration testing features ( |
Beta Was this translation helpful? Give feedback.
-
|
Thank you @penalosa In my worker, since I'm using The point is I don't need to test my whole worker just yet. I'm writing unit tests incrementally and this import just forces my to do extra setup for integration tests I don't even need. It would actually be cool to detect whether the tests are using |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the solution
Currently, when the
mainoption is specified inWorkersPoolOptions, the plugin automatically imports and loads the worker entrypoint. Even whenmainis set tonullorundefined, the plugin falls back to reading from the wrangler config file. For users who only run unit tests and don't need integration testing capabilities, this automatic import requires extensive mocking setup that isn't necessary for their use case.Describe the solution you'd like
Add a new option to
WorkersPoolOptionsthat allows disabling the automatic import of the main entrypoint:When
autoImportMainis set tofalse, the plugin would:mainoption or wrangler config)SELFimportDescribe alternatives you've considered
Additional context
This would be particularly beneficial for developers who:
SELFUse case
Unit-only testing scenarios where integration testing capabilities are not needed, and the automatic entrypoint import creates unnecessary setup overhead and complexity.
Beta Was this translation helpful? Give feedback.
All reactions