karma-runner / karma-sauce-launcher

A Karma plugin. Launch any browser on SauceLabs!
MIT License
199 stars 103 forks source link

Gzip test assets #154

Closed Havunen closed 4 years ago

Havunen commented 6 years ago

Hi

I was recently investigating iOS disconnect issue and found out that karma test files are not gzipped by default.

Then I started looking for solution and found this plugin

https://github.com/GreenGremlin/karma-gzip

Using that improved iOS a lot, Total test time went down from 1m 57s to 1m 28s and Bundle size went down from 4MB -> 657kb

why this plugin does not do that out of box?

johnjbarton commented 6 years ago

why this plugin does not do that out of box?

Because you did not send your PR yet?

Havunen commented 6 years ago

I was more like wondering should we include this functionality into karma-sauce-launcher or is it out of scope of this plugin

johnjbarton commented 6 years ago

Did you try https://www.npmjs.com/package/karma-gzip?

Havunen commented 6 years ago

yes, that was the point of this issue. I think developers are not aware of this fact that when you use sauce-launcher you need to manually gzip the test assets.

jdmarshall commented 6 years ago

I think Havunen asks a pretty good question.

It looks like this could be done as a PR against karma itself, rather than tacking it onto karma-sauce-launcher. It might be as simple as adding this around line 67 of lib/web-server.js:

var compression = require('compression'); handler.use(compression());

There's a way to do by passing a callback in through the config for beforeMiddleware, but is there a good reason not to include the compression middleware by default?

GreenGremlin commented 5 years ago

The karma devs actually removed gzip support some time ago. They have also, pushed back on adding support. I was recently able to get them to accept a PR that will allow me to simplify the karma-gzip considerably in a future update.

GreenGremlin commented 5 years ago

This discussion prompted me to update karma-gzip for karma v3.1. I've also renamed the package to karma-gzip-preprocessor, which should make even easier to use.

wswebcreation commented 4 years ago

Closing this due to inactivity, feel free to re-open if this is still an issue

jdmarshall commented 3 years ago

@GreenGremlin

They're pushing back on precomputed gzip assets. I don't see how adding the compression library adds some sort of undo complexity to the codebase.