Re: Error: No provider for "framework:mocha"! (Resolving: framework:mocha)

5,372 views
Skip to first unread message

Vojta Jína

unread,
Sep 2, 2013, 4:45:24 PM9/2/13
to david de diego, karma...@googlegroups.com
Hi Dave,

you can remove the "plugins" section from the config. By default, karma will load all the plugins installed in your node_modules (next to karma itself).

V.


On Mon, Sep 2, 2013 at 9:17 AM, david de diego <soun...@yahoo.com> wrote:
Hi Vojta, I hope that you are ok

I have installed karma-mocha


....

I am getting this output in the end


> phan...@1.9.1-8 install C:\Program Files\nodejs\node_modules\karma-phantomjs-launcher\node_modules\phantomjs
> node install.js

PhantomJS detected, but wrong version 1.9.0 @ C:\phantomjs\phantomjs-1.9.0-windows\phantomjs.EXE.
Download already available at \tmp\phantomjs\phantomjs-1.9.1-windows.zip
Extracting zip contents
Renaming extracted folder \tmp\phantomjs\phantomjs-1.9.1-windows -> C:\Program Files\nodejs\node_modules\karma-phantomjs-launcher\node_modules\phanto
Writing location.js file
Done. Phantomjs binary available at C:\Program Files\nodejs\node_modules\karma-phantomjs-launcher\node_modules\phantomjs\lib\phantom\phantomjs.exe
mo...@1.12.1 node_modules\mocha
├── gr...@1.7.0
├── di...@1.0.2
├── comm...@0.6.1
├── de...@0.7.2
├── mkd...@0.3.5
├── ja...@0.26.3 (mkd...@0.3.0)
└── gl...@3.2.1 (inhe...@1.0.0, grace...@1.2.3, mini...@0.2.12)

karma-scri...@0.1.0 node_modules\karma-script-launcher

karma-...@0.1.3 node_modules\karma-jasmine

karma-r...@0.1.0 node_modules\karma-requirejs

karma-chro...@0.1.0 node_modules\karma-chrome-launcher

karma-html2js...@0.1.0 node_modules\karma-html2js-preprocessor

karma-firef...@0.1.0 node_modules\karma-firefox-launcher

karma-coffee...@0.1.0 node_modules\karma-coffee-preprocessor
└── coffee...@1.6.3

karma-phanto...@0.1.0 node_modules\karma-phantomjs-launcher
└── phan...@1.9.1-8 (wh...@1.0.5, mkd...@0.3.5, n...@0.4.2, k...@0.1.7, adm...@0.2.1, rim...@2.0.3, npm...@0.0.24)

ka...@0.10.2 node_modules\karma
├── d...@0.0.1
├── col...@0.6.0-1
├── grace...@1.2.3
├── rim...@2.1.4
├── mi...@1.2.11
├── chok...@0.6.3
├── q...@0.9.6
├── mini...@0.2.12 (sig...@1.0.0, lru-...@2.3.1)
├── gl...@3.1.21 (inhe...@1.0.0)
├── coffee...@1.6.3
├── user...@2.0.7 (lru-...@2.2.4)
├── lod...@1.1.1
├── opti...@0.3.7 (word...@0.0.2)
├── log...@0.6.8 (deq...@1.0.3, as...@0.1.15, sem...@1.1.4, readabl...@1.0.17)
├── con...@2.8.8 (ui...@0.0.2, met...@0.0.1, cookie-s...@1.0.1, pa...@0.0.1, fr...@0.2.0, by...@0.2.0, buffer...@0.2.1, q...@0.6.5, debug@0.7.
├── http-...@0.10.3 (pkg...@0.2.3, ut...@0.1.7)
└── sock...@0.9.16 (base...@0.1.0, polic...@0.0.4, re...@0.7.3, socket.i...@0.9.16)

karma...@0.1.0 node_modules\karma-mocha

C:\Program Files\nodejs>:

* I have this Karma config file:


module.exports = function(config) {
  config.set({
    // base path, that will be used to resolve files and exclude
    basePath: '../',

    frameworks: ['mocha'],

    // list of files / patterns to load in the browser
    files : [

'app/lib/angular/angular.js',

'app/lib/angular/angular-*.js',

'test/lib/angular/angular-mocks.js',

'app/js/**/*.js',

'test/unit/mocha/**/*.js'

],

    // list of files to exclude
    exclude: [],

    // use dots reporter, as travis terminal does not support escaping sequences
    // possible values: 'dots', 'progress'
    // CLI --reporters progress
    reporters: ['progress', 'junit'],

    junitReporter: {
      // will be resolved to basePath (in the same way as files/exclude patterns)
      outputFile: 'test-results.xml'
    },

    // web server port
    // CLI --port 9876
    port: 9876,

    // enable / disable colors in the output (reporters and logs)
    // CLI --colors --no-colors
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    // CLI --log-level debug
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    // CLI --auto-watch --no-auto-watch
    autoWatch: true,

    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    // CLI --browsers Chrome,Firefox,Safari
    browsers: [process.env.TRAVIS ? 'Firefox' : 'Chrome'],

    // If browser does not capture in given timeout [ms], kill it
    // CLI --capture-timeout 5000
    captureTimeout: 20000,

    // Auto run tests on start (when browsers are captured) and exit
    // CLI --single-run --no-single-run
    singleRun: false,

    // report which specs are slower than 500ms
    // CLI --report-slower-than 500
    reportSlowerThan: 500,

    // compile coffee scripts
    preprocessors: {
      '**/*.coffee': 'coffee'
    },

    plugins: [
      'karma-jasmine',
      'karma-chrome-launcher',
      'karma-firefox-launcher',
      'karma-junit-reporter'
    ]
  });
};

* when I try to run my tests I am getting this error:

C:\angular-phonecat\test>karma start karma-mocha.conf.js
WARN [plugin]: Cannot find plugin "karma-junit-reporter".
  Did you forget to install it ?
  npm install karma-junit-reporter --save-dev
WARN [reporter]: Can not load "junit", it is not registered!
  Perhaps you are missing some plugin?

C:\angular-phonecat\test\node_modules\karma\node_modules\di\lib\injector.js:9
      throw error('No provider for "' + name + '"!');
            ^
Error: No provider for "framework:mocha"! (Resolving: framework:mocha)
    at error (C:\angular-phonecat\test\node_modules\karma\node_modules\di\lib\injector.js:22:68)
    at Object.parent.get (C:\angular-phonecat\test\node_modules\karma\node_modules\di\lib\injector.js:9:13)
    at get (C:\angular-phonecat\test\node_modules\karma\node_modules\di\lib\injector.js:54:19)
    at C:\angular-phonecat\test\node_modules\karma\lib\server.js:28:14
    at Array.forEach (native)
    at start (C:\angular-phonecat\test\node_modules\karma\lib\server.js:27:21)
    at invoke (C:\angular-phonecat\test\node_modules\karma\node_modules\di\lib\injector.js:75:15)
    at Object.exports.start (C:\angular-phonecat\test\node_modules\karma\lib\server.js:204:12)
    at Object.<anonymous> (C:\Users\U8011982\AppData\Roaming\npm\node_modules\karma\bin\karma:19:39)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:901:3

Can you help? :) thanks in advance

david de diego

unread,
Sep 3, 2013, 7:11:32 AM9/3/13
to Vojta Jína, karma...@googlegroups.com
Thanks for your reply Vojta, removed the plugins section on both the karma and karma-mocha package.json but it still does not work :(

Am I doing something wrong? could you share a karma conf that works for you so I can compare and see where I have gone wrong?

many thanks again :)


From: Vojta Jína <vojta...@gmail.com>
To: david de diego <soun...@yahoo.com>; "karma...@googlegroups.com" <karma...@googlegroups.com>
Sent: Monday, September 2, 2013 9:45 PM
Subject: Re: Error: No provider for "framework:mocha"! (Resolving: framework:mocha)

david de diego

unread,
Sep 3, 2013, 11:49:25 AM9/3/13
to Vojta Jína, karma...@googlegroups.com
Vojta, I got it working I had to add karma-mocha to the karma config plugins section:

    plugins: [
      'karma-mocha',       
      'karma-jasmine',
      'karma-chrome-launcher',
      'karma-firefox-launcher',
      'karma-junit-reporter'
    ]

 many thanks, David


From: david de diego <soun...@yahoo.com>
To: Vojta Jína <vojta...@gmail.com>; "karma...@googlegroups.com" <karma...@googlegroups.com>
Sent: Tuesday, September 3, 2013 12:11 PM

david de diego

unread,
Sep 5, 2013, 1:25:19 PM9/5/13
to Vojta Jína, karma...@googlegroups.com
Vojta please ignore my last email. it is all working fine.. although that nasty exception appeared on install the plugin works.

Kind regards,
David



Sent: Wednesday, September 4, 2013 5:07 PM
Subject: browserstack-launcher

Hi there, I have been experiencing some trouble installing browserstack-launcher
on windows 7 Professional:

I have satisfied the node-gyp Python dependency.


C:\angular-phonecat\test>npm install karma-browserstack-launcher --save-dev
npm http GET https://registry.npmjs.org/karma-browserstack-launcher
npm http 304 https://registry.npmjs.org/karma-browserstack-launcher
npm http GET https://registry.npmjs.org/browserstacktunnel-wrapper
npm http GET https://registry.npmjs.org/browserstack
npm http GET https://registry.npmjs.org/q
npm http 304 https://registry.npmjs.org/browserstacktunnel-wrapper
npm http 304 https://registry.npmjs.org/q
npm http 304 https://registry.npmjs.org/browserstack
npm http GET https://registry.npmjs.org/child-daemon
npm http 304 https://registry.npmjs.org/child-daemon
npm http GET https://registry.npmjs.org/pty.js
npm http 304 https://registry.npmjs.org/pty.js

> pty...@0.2.3 install C:\angular-phonecat\test\node_modules\karma-browserstack-launcher\node_modules\browserstacktunnel-wrapper\node_modules\child-da
emon\node_modules\pty.js
> node-gyp rebuild


C:\angular-phonecat\test\node_modules\karma-browserstack-launcher\node_modules\browserstacktunnel-wrapper\node_modules\child-daemon\node_modules\pty.j
s>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
gyp http GET http://nodejs.org/dist/v0.10.17/node-v0.10.17.tar.gz
gyp http 200 http://nodejs.org/dist/v0.10.17/node-v0.10.17.tar.gz
gyp http GET http://nodejs.org/dist/v0.10.17/x64/node.lib
gyp http GET http://nodejs.org/dist/v0.10.17/node.lib
gyp http 200 http://nodejs.org/dist/v0.10.17/x64/node.lib
gyp http 200 http://nodejs.org/dist/v0.10.17/node.lib
C:\angular-phonecat\test\node_modules\karma-browserstack-launcher\node_modules\browserstacktunnel-wrapper\node_modules\child-daemon\node_modules\pty.
js\build\deps\winpty\winpty-agent.vcxproj(18,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the
 path in the <Import> declaration is correct, and that the file exists on disk.
C:\angular-phonecat\test\node_modules\karma-browserstack-launcher\node_modules\browserstacktunnel-wrapper\node_modules\child-daemon\node_modules\pty.
js\build\deps\winpty\winpty.vcxproj(18,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path
in the <Import> declaration is correct, and that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error: `c:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\angular-phonecat\test\node_modules\karma-browserstack-launcher\node_modules\browserstacktunnel-wrapper\node_modules\child-daemon\node_
modules\pty.js
gyp ERR! node -v v0.10.17
gyp ERR! node-gyp -v v0.10.9
gyp ERR! not ok
npm WARN optional dep failed, continuing pty...@0.2.3
karma-browser...@0.0.4 node_modules\karma-browserstack-launcher
├── browse...@1.0.0
├── q...@0.9.6
└── browserstackt...@1.0.1 (child-...@0.0.2)

Any input would be greatly appreciated. many thanks in advance :)





david de diego

unread,
Sep 4, 2013, 12:07:49 PM9/4/13
to Vojta Jína, karma...@googlegroups.com

Vojta Jína

unread,
Sep 23, 2013, 4:57:23 PM9/23/13
to david de diego, karma...@googlegroups.com
David,

the reason why "expect(window).not().toBe(undefined)" fails is because the expect accepts a future as the first argument. You need to understand a bit more about how the angular scenario runner works inside, please search the karma mailing list, I explained that many times. I agree that this is kinda confusing, we should probably change it to accepts non-future values too.

I'm actually not sure if the angular scenario works with requirejs. When using requirejs, you are loading all the source asynchronously and then (once all the sources are fetched) you do a manual bootstrap. The problem is that the scenario runner does not wait for this:

I would recommend using trying Protractor, which is a new implementation of Scenario Runner, but on the top of WebDriver:

V.


On Thu, Sep 19, 2013 at 6:03 PM, david de diego <soun...@yahoo.com> wrote:
Hi Vojta, have you come accross issues using requirejs on angular e2e tests?
I can see the require js modules being loaded into the test. but they are not in the scope of angular scenario. I understand that angular e2e tests run on an iframe. has that got something to do with it?

Nevertheless even when I try:

expect(window).not().toBe(undefined);

it fails. how can I make the requirejs modules available to angular-scenario's context?

best regards,

David



From: david de diego <soun...@yahoo.com>
To: Vojta Jína <vojta...@gmail.com>
Sent: Thursday, September 12, 2013 11:26 AM
Subject: Re: browserstack-launcher

yep, thanks :)

Also I had to upgrade the browserStack jar to the latest too :)
I think there was not enough login info to see this so I had to add extra loging info to the browserStack-launcher js code.

all the best,

David



From: Vojta Jína <vojta...@gmail.com>
To: david de diego <soun...@yahoo.com>
Sent: Thursday, September 12, 2013 12:36 AM
Subject: Re: browserstack-launcher

Cool, glad it works.

It means that compilation of some native module failed. That does not surprise me at all on Windows ;-) Most of the native modules have JS fallback version, so it should work even without compiling the native module.

V.
Reply all
Reply to author
Forward
0 new messages