Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminal/console doesn't return control when tests are finished since 0.2.0 package version #5

Closed
1 of 3 tasks
KhalipskiSiarhei opened this issue Feb 5, 2018 · 2 comments

Comments

@KhalipskiSiarhei
Copy link

KhalipskiSiarhei commented Feb 5, 2018

Note: for support questions, please use stackoverflow. This repository's issues are reserved for feature requests and bug reports.

  • **I'm submitting a ... **

    • bug report
    • feature request
    • support request => Please do not submit support request here, see note at the top of this template.
  • What is the current behavior?
    Console/terminal doesn't return control when tests are finished. As a result the package for now can be considered for manual run only, it can't be used in any automated build process where it is expected to run next steps if tests were finished successfully.

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
    if I run a command ng test --watch=false --code-coverage=true --single-run=true --progress=true --colors=true --log-level=debug --reporters=progress,junit,coverage-istanbul --config=karma.conf.headless.js the console/terminal doesn't return control when tests are finished.

Here is my karma.conf.headless.js file:

// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function (config) {
    config.set({
        basePath: '',
        frameworks: ['parallel', 'jasmine', '@angular/cli'],
        parallelOptions: {
            executors: 4, // Defaults to cpu-count - 1
            shardStrategy: 'round-robin'
            // shardStrategy: 'description-length'  
        },
        plugins: [
            require('karma-jasmine'),
            require('karma-chrome-launcher'),
            require('karma-jasmine-html-reporter'),
            require('karma-coverage-istanbul-reporter'),
            require('karma-junit-reporter'),
            require('@angular/cli/plugins/karma'),
            require('karma-parallel')
        ],
        client: {
            clearContext: false // leave Jasmine Spec Runner output visible in browser
        },
        coverageIstanbulReporter: {
            reports: ['html', 'lcovonly', 'cobertura'],
            fixWebpackSourcePaths: true,
            // Most reporters accept additional config options. You can pass these through the `report-config` option
            'report-config': {
                // all options available at: https://github.com/istanbuljs/istanbuljs/blob/aae256fb8b9a3d19414dcf069c592e88712c32c6/packages/istanbul-reports/lib/html/index.js#L135-L137
                html: {
                    // outputs the report in ./coverage/html
                    subdir: 'html'
                }
            },
            thresholds: {
                // thresholds for all files
                global: {
                    statements: 95,
                    lines: 95,
                    branches: 73,
                    functions: 95
                },
            }
        },
        angularCli: {
            environment: 'dev'
        },
        files: [
        ],
        reporters: ['progress', 'kjhtml'],
        port: Math.floor((Math.random() * 500) + 9500),
        colors: true,
        logLevel: config.LOG_INFO,
        autoWatch: false,
        browsers: ['ChromeHeadless'],
        singleRun: true,
        concurrency: Infinity,
        customLaunchers: {
            ChromeHeadless: {
                base: 'Chrome',
                flags: [
                    '--headless',
                    '--disable-gpu',
                    // Without a remote debugging port, Google Chrome exits immediately.
                    `--remote-debugging-port=${Math.floor((Math.random() * 500) + 9000)}`,
                    '--no-sandbox'
                    // '--max_old_space_size=4096'
                ],
                debug: false
            }
        },
        // How long does Karma wait for a browser to reconnect (in ms).
        // With a flaky connection, it is pretty common that the browser disconnects, but the actual test execution is still running without any problems.
        // Karma does not treat a disconnection as an immediate failure and will wait for browserDisconnectTimeout (ms).If the browser reconnects during that time, everything is fine.
        // Default: 2000
        browserDisconnectTimeout: 6000,
        // The number of disconnections tolerated.
        // The disconnectTolerance value represents the maximum number of tries a browser will attempt in the case of a disconnection.
        // Usually, any disconnection is considered a failure, but this option allows you to define a tolerance level when there is a flaky network link between the Karma server and the browsers.
        // Default: 0
        browserDisconnectTolerance: 3,
        // How long will Karma wait for a message from a browser before disconnecting from it (in ms).
        // If, during test execution, Karma does not receive any message from a browser within browserNoActivityTimeout(ms), it will disconnect from the browser.
        // Default: 10000
        browserNoActivityTimeout: 60000,
        // Timeout for capturing a browser (in ms).
        // The captureTimeout value represents the maximum boot-up time allowed for a browser to start and connect to Karma.
        // If any browser does not get captured within the timeout, Karma will kill it and try to launch it again and, after three attempts to capture it, Karma will give up.
        // Default: 60000
        captureTimeout: 120000,
        // Karma will report all the tests that are slower than given time limit (in ms).This is disabled by default (since the default value is 0).
        reportSlowerThan: 1000
        // More info about disconnected issue is here:
        // https://github.com/karma-runner/karma-chrome-launcher/issues/154
        // https://github.com/karma-runner/karma/issues/2652
    });
};
  • What is the expected behavior?
    Control is returned as soon as tests finished with the appropriate code depends on tests results

  • What is the motivation / use case for changing the behavior?
    To be able to use this great package in automated build process which doesn't require manual run (build check-in policy, for example)

  • Please tell us about your environment:

  • package version: 0.2.0
  • Angular CLI 1.4.9
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
@joeljeske
Copy link
Owner

This was caused by not ensuring we relay the done status from the onExit event. Thanks for finding this issue!

@KhalipskiSiarhei
Copy link
Author

Nice, it does work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants