Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to init ocLazyLoad using Jasmine test runner #129

Closed
craigg75 opened this issue Feb 10, 2015 · 12 comments
Closed

unable to init ocLazyLoad using Jasmine test runner #129

craigg75 opened this issue Feb 10, 2015 · 12 comments
Labels

Comments

@craigg75
Copy link

I have a lot of Jasmine tests that I've been running for several months successfully. I recently started using the wonderful ocLazyLoad module. But now I'm getting this error on all tests --

No module found during bootstrap, unable to init ocLazyLoad

I'm not really sure how to try to work around this bug. I noticed in another issue #123 that a user noticed that if you load it before the mocks.js file it works. I tried that and have used the latest ocLazyLoad.js from the src folder. Neither one of these ideas worked :(

@ocombe
Copy link
Owner

ocombe commented Feb 10, 2015

Hi, have you tested with the file in the src folder from the current master ? I've made changes recently but haven't released a new version yet.

@craigg75
Copy link
Author

Yes I tried that last night since I noticed you were having others try the version from the src folder to get through this issue. As a temporary fix I may just create a separate app.js and index.html file that doesn't include the ocLazyLoad module. I'm sure you will fix this at some point and I don't want you to feel rushed. I'd try my hand at helping you with this but I consider myself to still be a newbie with angular and I still haven't groked what's going on underneath :)

Update: I copied my app.js to app-temp.js and removed the references to the ocLazyLoad module and point my jasmine specrunner to app-temp.js and my tests are running fine again. Looking forward to your fix. No hurry though since I'm back in business with this temporary fix.

@ocombe
Copy link
Owner

ocombe commented Feb 10, 2015

Okay :)
Yes this should be fixed soon I hope.

@ocombe ocombe added the bug label Feb 10, 2015
@kloy
Copy link

kloy commented Feb 14, 2015

I am creating a dummy module that depends on ocLacyLoad and bootstraps before the tests are executed. This solves the issue albeit very hackish.

@roymilder
Copy link

Just want to confirm that I had the same issue (No module found during bootstrap, unable to init ocLazyLoad) and that the current master in the src folder did fix the issue.

thanks

@carlos-algms
Copy link

I created a jsfiddle that reproduces the error.

https://jsfiddle.net/carlosalgms/ga3etdvo/2/

Apparently the error only raises if a decribe() have 2 or more it() insede.
If you have only 1 it(), the test runs successfully.

@carlos-algms
Copy link

How we can insert content into phantomJS before he init the tests?
Because if I insert a div with ng-app, the tests runs smoothly.

Ex:
http://jsfiddle.net/carlosalgms/ga3etdvo/

@ocombe
Copy link
Owner

ocombe commented Feb 26, 2015

Well phantomJS is an headless browser but it's a browser nonetheless, so it should work the same as for chrome or firefox.
You need to instantiate your app one way or the other: with an ng-app directive, or with angular.bootstrap.
If you don't, it's not a regular Angular App and ocLazyLoad won't work for now. The new version I'm working on should be easier to test.

I forked your jsfiddle and added the angular.bootstrap to make it work without any DOM: http://jsfiddle.net/562uq3zx/

@ocombe
Copy link
Owner

ocombe commented Feb 26, 2015

It should be fixed in 0.6.0!

@gustavolira
Copy link

Hi @ocombe , sorry to be inconvinience... I just updated to 0.6.0 and I'm receiving the same error.
I'm receiving:
Running "karma:unit" (karma) task
INFO [karma]: Karma v0.12.31 server started at http://localhost:8083/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.8 (Linux)]: Connected on socket ayS0NvUwA4VOlxyEtXKW with id 45489088
WARN [web-server]: 404: /undefined
PhantomJS 1.9.8 (Linux): Executed 0 of 1 ERROR (0.001 secs / 0 secs)
Warning: Task "karma:unit" failed. Use --force to continue.

@ocombe
Copy link
Owner

ocombe commented Feb 27, 2015

@gustavolira could you make me a small zip with a minimal test case so that I can find out what the problem is please ? Send it to olivier.combe@gmail.com

@craigg75
Copy link
Author

Thanks for the fix, works great in Jasmine now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants