Error when running angularjs karma sample
Asked Answered
C

5

13

In the introtokarma app, I changed the karma-e2e-config.js file as follows:

module.exports = function(config) {
  config.set({
    basePath : '../',
      files : ['tests/e2e/**/*.js'],
      frameworks: ['ng-scenario'],
      autoWatch : false,
      browsers : ['Chrome'],
      singleRun : true,
      proxies : {
        '/': 'http://localhost:8000/'
      },
      junitReporter : {
        outputFile: 'test_out/e2e.xml',
        suite: 'e2e'
      }
  });
};

When running the code, I get the following output:

C:\Project\introtokarma\config>karma start karma-e2e.conf.js
INFO [karma]: Karma v0.10.1 server started at localhost:9877/
INFO [launcher]: Starting browser Chrome
WARN [launcher]: The path should not be quoted.
Normalized the path to C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
INFO [Chrome 28.0.1500 (Windows 7)]: Connected on socket id pfBNNRs-3wAdgT-QsheL
Chrome 28.0.1500 (Windows 7): Executed 0 of 0 ERROR (0.207 secs / 0 secs)

Closeup answered 8/8, 2013 at 19:54 Comment(0)
W
26

For karma v0.10.2 and latest angular-phonecat try next command:

npm install -g karma-ng-scenario karma-junit-reporter

Wondawonder answered 24/9, 2013 at 13:8 Comment(4)
I tried all of the other suggestions, and was missing karma-junit-reporter.Agnesagnese
the important thing is: use the -g flag to install it globally instead of locally: npm help installReproductive
This helped! I wonder why this dependency is not mentioned in Angularjs tutorial. It's a step-by-step tutorial, I wonder why'd they oversee this clearly needed module.Wobble
this needs to be in tutorial for sure. docs.angularjs.org/tutorial/step_03Rebuttal
C
4

You need to change the files key array of the config block and add a frameworks key.

the files key looks like this:

files: [
    ANGULAR_SCENARIO,
    ANGULAR_SCENARIO_ADAPTER,
    'test/e2e/**/*.js'
]

Remove the ANGULAR_SCENARIO, and ANGULAR_SCENARIO_ADAPTER lines.

So, in the end, it just looks like this:

files: [
    'test/e2e/**/*.js'
]

Then add a framkeworks key with an array and one value of ng-scenario:

frameworks: ['ng-scenario']

Hope that helps.

Cnidoblast answered 10/8, 2013 at 20:29 Comment(4)
That did not work. Thanks for your quick reply though. I updated the post to work with introtokarmaCloseup
I tried that, but now I'm getting: Error: No provider for "framework:ng-scenario"! (Resolving: framework:ng-scenario)Angola
Adam - try npm install karma-ng-scenario and see if that helpsCnidoblast
Thanks, this worked for me (including installing karma-ng-scenario).Pekan
O
1

Besides installing the karma-ng-scenario node module as @rkshnsk said, I also had to add it to the plugins array:

  plugins : ['karma-ng-scenario'],
Overage answered 22/3, 2014 at 8:37 Comment(0)
D
0

It should be "test" instead of "tests" in

      files : ['tests/e2e/**/*.js'],
Dimitrovo answered 14/8, 2013 at 14:13 Comment(0)
C
0

Thanks for your replies. I switched to karma 0.8.7 and everything works now.

Closeup answered 20/8, 2013 at 19:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.