karma-runner / karma

Spectacular Test Runner for JavaScript
http://karma-runner.github.io
MIT License
11.96k stars 1.71k forks source link

Karma takes approx. two minutes to start #2859

Open dcortes92 opened 6 years ago

dcortes92 commented 6 years ago

When running the tests. It takes about two minutes for karma to start. After that, all the tests run smoothly. I'm only using a couple of plugins and I tried disabling them with the same result.

I don't consider this an issue of ChromeHeadless since I was using PhantomJS previously with the same result. Our test suite is ~400 tests.

image

Expected behaviour

Karma should start faster.

Actual behaviour

Karma takes about two minutes to start.

Environment Details

process.env.CHROME_BIN = require('puppeteer').executablePath();

module.exports = function(config) { config.set({ frameworks: ['jasmine'], files: [ 'test/*/-spec.js', ], plugins: [ 'karma-webpack', 'karma-jasmine', 'karma-sourcemap-loader', 'karma-spec-reporter', 'karma-coverage-istanbul-reporter', 'karma-chrome-launcher' ], reporters: [ 'spec', 'coverage-istanbul' ], coverageIstanbulReporter: { reports: ['html', 'text'], thresholds: { statements: 100, lines: 100, branches: 100, functions: 100 }

},
port: 9876,
colors: true,
logLevel: config.LOG_DEBUG,
autoWatch: false,
singleRun: true,
browsers: ['ChromeHeadless']

}); };



### Steps to reproduce the behaviour

1. `yarn run test`
EzraBrooks commented 6 years ago

Are you still experiencing this on the most recent master? There was another issue regarding runtime that seemed to have been fixed elsewhere.

dcortes92 commented 6 years ago

Thanks for the reply. Yes I'm still having the same issue with the most recent version 1.7.1. It's taking ~2 minutes to start. This is the output I'm getting when running with LOG_DEBUG:

karma

I've tried disabling all my plugins with the same result.

EzraBrooks commented 6 years ago

Hmm. I wonder if this could be diagnosed by adding some more debug logging into the server startup process. Seems like a pretty glaring omission if it’s doing something for two minutes and doesn’t say anything.

dcortes92 commented 6 years ago

Any updates on this?

johnjbarton commented 6 years ago

I suggest you run karma-runner under the nodejs debugger https://nodejs.org/en/docs/guides/debugging-getting-started/ https://hackernoon.com/debug-node-js-with-chrome-devtools-aca7cf83af6b

Then when you get to the long pause break into the execution to see what is happening next.

AshuSingh07 commented 4 years ago

It takes around 40 min for karma to start with my headless chrome,firefox or phantomjs It get strucks at: karma start ./test-config/karma.conf.js

i 「wdm」: Compiled with warnings. i 「wdm」: Compiling...

After around 40mins it then continues running the test cases.

Could anyone help me on this issue.

johnjbarton commented 4 years ago

「wdm」: Compiled with warnings. I suggest you investigate "wdm_". That is not a karma thing.