valotas / karma-parcel

Karma with Parcel bundler
MIT License
6 stars 2 forks source link

Run karma as a parcel reporter #51

Open valotas opened 1 year ago

valotas commented 1 year ago

Karma calling Parcel

At the moment, we are creating a parcel instance used to bundle the tests files found by karma during pre-processing and we let karma now of a new test file (the one with the bundle created). Then our custom middleware waits until the bundle is created (event.type === "buildSuccess") to continue serving it.

This works ok, but during watching it might be problematic since parcel does not notify us of a buildStart event. For that a parcel reporter is needed but there is no way of passing a reporter instance to the parcel instance we create initializing karma since parcel configuration at the time of this writing can only accept packageNames (as strings).

Parcel calling Karma

A different approach would be to have a parcel reporter that initializes karma and run the tests.