AngularJS - Karma (e2e) : Executed 0 of 0 ERROR
Asked Answered
E

5

6

I am experiencing a problem which I could not solve for some time, and getting very frustrating since I don't have an idea what I am doing wrong in it. :) Any help is much appreciated. I am using requirejs in my applications as well. This is basically what I am trying to build; https://github.com/Cengizism/base

When I try to start my e2e test I get this on my console;

INFO [karma]: Karma v0.10.0 server started at http://localhost:8080/_karma_/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 28.0.1500 (Mac OS X 10.8.4)]: Connected on socket id n-0AVRliCogs2nWBfgDz
Chrome 28.0.1500 (Mac OS X 10.8.4): Executed 0 of 0 ERROR (0.208 secs / 0 secs)

My configuration file looks like this;

module.exports = function(karma) {
    'use strict';

    karma.set({
        frameworks: ['jasmine', 'ng-scenario'],

        files: [
          'app/vendors/angular-scenario/angular-scenario.js',
          'test/e2e/*.js'
        ],

        basePath: '',

        exclude: [],

        reporters: ['progress'],

        port: 8080,

        runnerPort: 9100,

        colors: true,

        logLevel: karma.LOG_INFO,

        autoWatch: true,

        browsers: ['Chrome'],

        captureTimeout: 5000,

        singleRun: false,

        proxies: {
          '/': 'http://localhost:9000/'
        },

        urlRoot: '/_karma_/',

        plugins: [
          'karma-jasmine',
          'karma-ng-scenario',
          'karma-chrome-launcher',
          'karma-firefox-launcher',
          'karma-phantomjs-launcher'
        ]
    });
};

and finally the spec file;

describe('Simple E2e Test', function()
{
    it('Should open the front page and check', function()
    {
        browser().navigateTo('/#/partial1');

        sleep(1);

        expect(element('#test').html()).toEqual('Hi testUser1');
    });
});
Electroencephalograph answered 7/8, 2013 at 11:37 Comment(3)
I've had this same problem yesterday, and after a long trial/error session, I fixed it by adding ANGULAR_SCENARION and ANGULAR_SCENARIO_ADAPTER as the two first elements f the files array (and removing 'app/vendors/angular-scenario/angular-scenario.js' from this array). Try that.Hail
@JB Nizet I tried that then it complains about angular scenario itself. Seems like it can not find it at all. Because browser() method does nto exist then. :/ PhantomJS 1.9.1 (Mac OS X) Simple E2e Test Should open the front page and check FAILED ReferenceError: Can't find variable: browserElectroencephalograph
@JBNizet Many thanks. Perhaps you should make this an answer. It's interesting that even though my karma version (0.10.8) explicitly states on run that "WARN [config]: ANGULAR_SCENARIO is not supported anymore", putting these two back in, at the top of the files list and without any reference to jasmine, works OK.Marked
M
12

Maybe this could help you:

To fix it, the following line should be included in karma.conf.js

exclude: ['app/lib/angular/angular-scenario.js'],

Source : https://github.com/angular/angular-phonecat/issues/71

Melli answered 15/10, 2013 at 15:25 Comment(0)
C
4

I'm not exactly clear on this either, but after running into this issue I removed the file angular-scenario from loading and was able to get the tests to run. I believe the problem is the difference between unit testing and e2e testing configuration.

Cathay answered 7/8, 2013 at 16:9 Comment(2)
I have it kind of working now but facing with an another problem. Works fine with PhantomJS without throwing errors but on browser, it flips. Please take a look on this one; github.com/karma-runner/karma/issues/682Electroencephalograph
Worked for me too. With angular-scenario.js under files[] zero tests were executed. Without it, it just worked (karma version 0.10.2).Schofield
F
3

I had this same error, and it went away once I started adding some tests. Is it possible the error just means there aren't any tests present?

Fringe answered 31/3, 2015 at 14:16 Comment(1)
Exactly what I was going to answer to this question. The error says clearly that there are 0 tests to run.Feigin
S
0

It could be due to the relative paths you add in files [] which may be wrong. I had the same error, and after it works fine !

Sudatorium answered 10/3, 2015 at 20:25 Comment(2)
I could run my tests with Karma without getting that error.Sudatorium
What fracz meant, is what is it you did, to make it work fine ?Pascha
I
0

In my case, the module format was wrong in a shim file that was only used by karma. I changed the format to 'register' to support SystemJS modules, per the documentation found here.

System.config({
    packages: {
        'base/dist/client': {
            warnings: true,
            defaultExtension: 'js',
            format: 'register',
            map: { }
        }
    }
});

This is what the TS output looked like. I have to assume that these tests were wrapped as system modules, so they were not loading properly. In other words, the error resulted from no tests running.

System.register(['angular2/testing', "./data-pipe"], function(exports_1) {
    var testing_1, data_pipe_1;
    return {
        setters:[
            function (testing_1_1) {
                testing_1 = testing_1_1;
            }
        ]

              // yada, yada, yada..

        }
    }
});
Inject answered 6/3, 2016 at 21:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.