Getting “Mismatched anonymous define() module…” when I try running tests

前端 未结 2 1434
囚心锁ツ
囚心锁ツ 2020-11-30 09:24

I am trying to configure my karma jasmine unit testing with requirejs. But each time i run it, i am getting the below error:

Chrome 34.0.1847 (Mac OS X 10.9.         


        
2条回答
  •  醉梦人生
    2020-11-30 09:54

    Since you're loading the specific .js files you need in your test-main.js with the paths: { } parameter, you don't have to explicitly list them in karma.config.js. Instead, you can just use your line { pattern: 'app/**/*.js', included: false }. All the lines before that are redundant. Just make sure you have the included: false modifier, otherwise Karma will load them in-line, and you'll get the Uncaught Error: Mismatched anonymous define() problem

提交回复
热议问题