jeudi 1 février 2018

ng test not working after upgrade to Karma 2.0.0

Yesterday I upgraded Angular from v4.4 to v5.2 and Karma from v1.7.1 to v2.0.0. Since doing this I can't run ng test.

I can run the tests using the karma start myconfigfile.js --single-run and they all pass correctly, but when I try ng test, the browser opens but hangs after displaying 'Karma - starting'. There is no console output.

I've tried both Chrome and ChromeHeadless for the browser but have run out of ideas. Any help would be appreciated.

Config:

module.exports = function (config) {
    config.set({
        basePath: '',
        frameworks: ['jasmine', '@angular/cli'],
        plugins: [
            require('karma-jasmine'),
            require('karma-chrome-launcher'),
            require('karma-coverage-istanbul-reporter'),
            require('karma-jasmine-html-reporter'),
            require('karma-spec-reporter'),
            require('karma-junit-reporter'),
            require('@angular/cli/plugins/karma')
        ],
        client: {
            clearContext: false // leave Jasmine Spec Runner output visible in browser
        },
        files: [
            { pattern: './src/test.ts', watched: false }
        ],
        preprocessors: {
            './src/test.ts': ['@angular/cli']
        },
        mime: {
            'text/x-typescript': ['ts', 'tsx']
        },
        coverageIstanbulReporter: {
            reports: ['html', 'lcovonly', 'cobertura'],
            fixWebpackSourcePaths: true,
            'report-config': {
                cobertura: {
                    file: 'coverage.xml'
                }
            }
        },
        angularCli: {
            environment: 'dev'
        },
        reporters: ['spec', 'kjhtml', 'junit', 'coverage-istanbul'],
        junitReporter: {
            outputDir: '',
            outputFile: 'test-results.xml',
            useBrowserName: false
        },
        port: 9876,
        colors: true,
        logLevel: config.LOG_INFO,
        autoWatch: false,
        browsers: ['ChromeHeadless'],
        singleRun: true,
        browserNoActivityTimeout: 60000,
        browserDisconnectTolerance: 5
    });
};

Aucun commentaire:

Enregistrer un commentaire