Karma tests error "unable to init ocLazyLoad"
Asked Answered
B

2

10

From the quickstart sb-admin-angular, I am trying to run the tests, but I get the error unable to init ocLazyLoad. (This is a Windows7 machine.)

The command I use to run the tests is:

$ grunt test --force

I understand from this thread that I must make sure that the path to the ocLazyLoad script is added in karma.conf.js.

files: [
  'bower_components/angular/angular.js',
  'bower_components/angular-mocks/angular-mocks.js',
  ...
  'bower_components/oclazyload/dist/ocLazyLoad.min.js',
  'app/scripts/**/*.js',
  'test/mock/**/*.js',
  'test/spec/**/*.js'
],

I have also tried using Bower to reinstall ocLacyLoad, as suggested in the aforementioned thread. I was given a choice of versions and selected the first option:

Unable to find a suitable version for oclazyload, please choose one:
    1) oclazyload#~0.5.2 which resolved to 0.5.2 and is required by sb-admin
    2) oclazyload#^1.0.9 which resolved to 1.0.9

What step am I missing or corrupting here, please?

Brolly answered 23/3, 2016 at 1:17 Comment(0)
M
5

I would update oclazyload in bower.json file to version 0.6.0 or higher. Some 0.5.x version introduced this bug and it is solved at 0.6.0 version on.

Current value on bower.json value of the example was 0.5.2 which you used, too.

References:

[1] https://github.com/ocombe/ocLazyLoad/issues/122 (issue in GitHub)

Minister answered 29/3, 2016 at 20:6 Comment(6)
I tried updating to 0.6.0. There was no change in outputBrolly
did you use bower uninstall for the old package? So, that the correct version really comes in use.Minister
No. I did not take that step. I can't attempt it right now. If the bounty expires before I can try again, and it does work, I will figure out how to get you your points.Brolly
There comes an award period after the bounty expires, another 24h to react.Minister
Cool, I can definitely find time to test before that timeBrolly
Actually, if you can get back to the selection phase, do select !2 instead of 1 and you are ok. You are facing a version conflict and !2 forces the newest to be used always. Look: #25916229 and remember the ! before 2 so it greates that resolution!Minister
J
3

It looks like this is what you are experiencing:

This should be fixed in ocLazyLoad 0.6.0.

Jughead answered 25/3, 2016 at 2:35 Comment(1)
upgraded to 0.6.0. No changeBrolly

© 2022 - 2024 — McMap. All rights reserved.