DEV Community

Pablo
Pablo

Posted on

Angular Tests

I'm trying to figure it out why I'm getting DISCONNECTED while running my tests.

So I did this to see what's been tested:

npm i karma-spec-reporter --save-dev

karma.conf.js

plugins: [require('karma-spec-reporter'), ...],
reporters: ['spec', ...],
specReporter: {
    maxLogLines: 5, // limit number of lines logged per test
    suppressErrorSummary: true, // do not print error summary
    suppressFailed: false, // do not print information about failed tests
    suppressPassed: false, // do not print information about passed tests
    suppressSkipped: true, // do not print information about skipped tests
    showSpecTiming: false // print the time elapsed for each spec
},

https://stackoverflow.com/a/58202615/1958882

And added this:
captureTimeout: 210000,
browserDisconnectTolerance: 3, 
browserDisconnectTimeout : 210000,
browserNoActivityTimeout : 210000,

https://github.com/jasmine/jasmine/issues/1413#issuecomment-334247097

browsers: ["Chrome-headless"],
customLaunchers: {
    "Chrome-headless": {
        base: 'Chrome',
        flags: [
            '--no-sandbox',
            '--disable-gpu',
            '--enable-logging',
            '--no-default-browser-check',
            '--no-first-run',
            '--disable-default-apps',
            '--disable-popup-blocking',
            '--disable-translate',
            '--disable-background-timer-throttling',
            '--disable-renderer-backgrounding',
            '--disable-device-discovery-notifications',
            '--remote-debugging-port=9222',
            '--disable-web-security',
            '--watch=false'
        ]
    }
},

https://github.com/jasmine/jasmine/issues/1413#issuecomment-432112670

And still, this damn thing it's not working... 😡

Avoid karma tests running twice on autoWatch
autoWatch: false,

https://pracucci.com/avoid-karma-tests-run-twice-on-autowatch.html

Top comments (0)