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');
    });
});
  • 2
    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. – JB Nizet Aug 7 '13 at 11:59
  • @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: browser – Cengiz Ulusoy Aug 7 '13 at 12:53
  • @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. – Engineer Dec 31 '13 at 16:47
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..

        }
    }
});
|improve this answer|||||
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?

|improve this answer|||||
  • Exactly what I was going to answer to this question. The error says clearly that there are 0 tests to run. – mila Jul 7 '15 at 12:00
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 !

|improve this answer|||||
  • I could run my tests with Karma without getting that error. – Noum Mar 11 '15 at 0:12
  • What fracz meant, is what is it you did, to make it work fine ? – Stephane Apr 7 '15 at 6:19
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

|improve this answer|||||
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.

|improve this answer|||||
  • 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/682 – Cengiz Ulusoy Aug 7 '13 at 16:44
  • Worked for me too. With angular-scenario.js under files[] zero tests were executed. Without it, it just worked (karma version 0.10.2). – Robin Sep 17 '13 at 8:37
  • Thanks, that fixed it for me too! – Tyson Cadenhead Dec 12 '14 at 3:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.