Thursday, March 31, 2016

Karma tests error “unable to init ocLazyLoad”

Leave a Comment

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?

2 Answers

Answers 1

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)

Answers 2

It looks like this is what you are experiencing:

This should be fixed in ocLazyLoad 0.6.0.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment