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

result.time always set to null #3040

Closed
J-Swift opened this issue Jun 12, 2018 · 2 comments
Closed

result.time always set to null #3040

J-Swift opened this issue Jun 12, 2018 · 2 comments

Comments

@J-Swift
Copy link

J-Swift commented Jun 12, 2018

Expected behaviour

reportSlowerThan reports slow tests

Actual behaviour

Nothing gets reported because result.time within BaseReporter.onSpecResult is always null

Environment Details

  • Karma version (output of karma --version): v2.0.2
  • Relevant part of your karma.config.js file
module.exports = function(config) {
    config.set({
        basePath: '',
        frameworks: ['jasmine', '@angular/cli'],
        plugins: [
            require('karma-jasmine'),
            require('karma-chrome-launcher'),
            require('karma-jasmine-html-reporter'),
            require('karma-coverage-istanbul-reporter'),
            require('@angular/cli/plugins/karma')
        ],
        reportSlowerThan: 1,
        client: {
            clearContext: false
        },
        files: [{
            pattern: './src/test.ts',
            watched: false
        }],
        preprocessors: {
            './src/test.ts': ['@angular/cli']
        },
        mime: {
            'text/x-typescript': ['ts', 'tsx']
        },
        coverageIstanbulReporter: {
            reports: ['html', 'lcovonly'],
            fixWebpackSourcePaths: true
        },
        angularCli: {
            environment: 'dev'
        },
        reporters: config.angularCli && config.angularCli.codeCoverage ? ['progress', 'coverage-istanbul'] : ['progress', 'kjhtml'],
        port: 9876,
        colors: true,
        logLevel: config.LOG_INFO,
        autoWatch: true,
        browsers: ['Chrome'],
        singleRun: false
    });
};

Steps to reproduce the behaviour

  1. Set reportSlowerThan to non-zero value
  2. Run tests
  3. Observe that no slow tests get reported
@johnjbarton
Copy link
Contributor

As far as I can tell reportSlowerThan is just passed to reporters. There is no internal support in karma for this feature. (IMO this feature should be replaced with a way to configure reporters).

@J-Swift
Copy link
Author

J-Swift commented Jun 12, 2018

OK, interesting. After digging further, it ended up being related to karma-jasmine, as outlined in this issue: karma-runner/karma-jasmine#196

I upgraded to karma-jasmine v1.1.2 and it fixed things for me.

@J-Swift J-Swift closed this as completed Jun 12, 2018
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