marvinhagemeister / karma-esbuild

Preprocessor based on esbuild for the karma test runner
MIT License
21 stars 10 forks source link

Eliminate the test files from the Karma runner #16

Closed jridgewell closed 3 years ago

jridgewell commented 3 years ago

We currently output a useless file for each test, so that Karma won't serve the real JS code in that file. This leads to duplication when debugging with sourcemaps enabled, as we'll see 2 foo.test.jss when searching files.

Screen Shot 2021-03-08 at 7 50 50 PM

Well, Karma has a type on the file. Our files are currently js type (just means script, doesn't matter if the file is .ts or .jsx). And if we change the file to a dom type then Karma will treat the content as something to inject into the DOM tree. Coupled with an empty contents, make Karma skip the file, and we're left with only the virtual file from the sourcemap.

Screen Shot 2021-03-08 at 7 54 02 PM