Lazy loaded modules for Jasmine tests. Angularjs

Skip to first unread message

May 2, 2018, 5:08:20 PM5/2/18
to karma-users
I have some lazy loaded modules in my app.
But I cannout use them for my jasmine tests. I cannot init/load module inside beforeEach or where else
And I couldn't find any information on this question.
 Is it possible to do for my application.

my karma config: 


       plugins: [








       preprocessors: {

           'app/**/*.spec.js': ['babel'],

           'app/components/my.lazy.module.js': ['babel']


       babelPreprocessor: {

           options: {

               presets: ['es2015'],

               plugins: ['syntax-dynamic-import']



       files: [








        frameworks: [



        reporters: [



I tried load it something like that 

beforeEach(inject(($ocLazyLoad) => {

       import(/* webpackChunkName: "my.lazy" */ 'base/app/components/my.lazy.module.js')

           .then(mod => {

               return $ocLazyLoad.inject(mod.MyLazyModule);



Can it be done in angularjs with webpack? What I'm doing wrong? 
I will answer any clarifying questions. Please, help me)

Reply all
Reply to author
0 new messages