mardi 1 mars 2016

Karma Run Complete, Exiting multiple times

My Karma tests are running with locally and with SauceLabs successfully, but they run three times. You can see some of the same messages when I run with debug mode. Any ideas on this?

My set up:

  • Angular (2.0.0-beta.7 + necessary includes)
  • Karma (0.13.21)
  • Jasmine (2.4.1)
  • Karma Jasmine (0.3.7)
  • SauceLabs Connect (4.3.13 linux)
  • Karma Sauce Launcher (0.3.0)

Also breaks without SauceLabs, when ran locally

Karma Running Three Times

karma.conf.js:

module.exports = function (config) {
    var launchers = {
        sl_chrome: {
            base: 'SauceLabs',
            browserName: 'chrome',
            platform: 'Windows 10',
            version: '48'
        }
    };

    config.set({
        autoWatch: false,
        basePath: '.',
        colors: true,
        frameworks: ['jasmine'],
        logLevel: config.LOG_INFO,
        port: 9876,
        singleRun: true,

        browsers: Object.keys(launchers),
        customLaunchers: launchers,
        sauceLabs: {
        accessKey: process.env.PORTFOLIO_SAUCELABS_KEY,
        recordVideo: true,
        recordScreenshots: true,
        testName: process.env.PORTFOLIO_SAUCELABS_TEST_NAME,
        username: process.env.PORTFOLIO_SAUCELABS_USERNAME
        },

        coverageReporter: {
            reporters: [
                { file: 'coverage-final.json', type: 'json' }
            ]
        },

        files: [
            // Load Angular 2 dependencies and the SystemJS shim
            { pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: true },
            { pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: true },
            { pattern: 'node_modules/rxjs/bundles/Rx.js', included: true, watched: true },
            { pattern: 'node_modules/angular2/bundles/angular2.dev.js', included: true, watched: true },
            { pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, watched: true },
            { pattern: 'node_modules/angular2/**/*.js', included: false, watched: false },
            { pattern: 'test/karma-test-shim.js', included: true, watched: true },

            // The application and test files
            { pattern: 'app/**/*.js', included: false, watched: true },
            { pattern: 'test/unit/app/**/*.js', included: false, watched: true },

            // Support for debugging seessions
            { pattern: 'app/**/*.ts', included: false, watched: false },
            { pattern: 'test/unit/app/**/*.js.map', included: false, watched: false }
        ],

        plugins: [
            'karma-coverage',
            'karma-jasmine',
            'karma-sauce-launcher'
        ],

        preprocessors: {
            'app/**/*.js': ['coverage']
        },

        proxies: {
            '/angular2/': '/base/node_modules/angular2/',
            '/app/': '/base/app/',
            '/node_modules/': '/base/node_modules/'
        },

        reporters: [
            'coverage',
            'progress',
            'saucelabs'
        ]
    })
}

The Test

/// <reference path="../../../../../../typings/main.d.ts" />

'use strict';

import {beforeEach, describe, expect, inject, it}   from 'angular2/testing';

describe('When testing', () => {
    it('it should pass', () => {
        expect(true).toEqual(true);
    });
});

Aucun commentaire:

Enregistrer un commentaire