angular-librarian icon indicating copy to clipboard operation
angular-librarian copied to clipboard

Watching tests shouldn't restrict browser choices

Open SirDarquan opened this issue 7 years ago • 2 comments

Currently, running tests has three options: Headless, Watch and All. I can do a headless test, which seems to be meant for CI environments. I can watch tests and the Chrome browser will open and continuously retest as I develop. All will test in both Chrome and Headless for a single run. There also the default, but that is just the Headless configuration. While convenient, his actually causes a few problems. First it assumes the developer has Chrome installed. I know it's preposterous to think someone doesn't have Chrome installed but at my normal job, there was a developer who was so Open Source oriented that he used Chromium instead of Chrome. We had to adjust our debugging process for him. Headless is a nice option since it can be installed with npm with no work from the developer. The all option uses the values in the karma config file and should be the default. Watching on the other hand should be option at all times. As such, you should move watching to a literal option which would produce: ngl test <= would test against all browsers the karma config ngl test headless <= would test against PhantomJs ngl test --watch <= would test against all browsers in the karma config continuously ngl test headless --watch <= would test against PhantomJs continuously ngl test --browsers=Chrome,Firefox <= overrides the browsers to test with ngl test --browsers=Chrome,Firefox --watch <= overrides the browsers to test with continuously

IMO, this gives us the best options for both a CI perspective and local testing.

SirDarquan avatar Feb 04 '18 19:02 SirDarquan

My first question here, you couldn't override the broswer by using a karma.conf.js via custom configuration?

If that's the case, we could just fix that mechanism to ensure that the custom config supersedes the base browsers specified in the test.js file

gonzofish avatar Feb 05 '18 14:02 gonzofish

Currently the custom config is merged with the base config and there's nothing wrong with that. The override is only for situations where you want to test a subset of browsers without changing your config. I made a PR to show what I mean.

SirDarquan avatar Feb 05 '18 19:02 SirDarquan