0

Currently I am writing jasmine specs for already developed backbone.js application. I have to write jasmine specs for each module for unit testing. I have a module in which one of the .js (say abc.js) file is generated after grunt build task and we are setting dependency using require.js. Now in the same way in my spec file also I am setting require('abc') but it says 404 not found error as this abc.js file is exists only in generated build. Can I get any suggestions how to create dependency of abc.js file for my specs. FYI, my application uses karma, jasmine, require, backbone.

3
  • 1
    If abc.js is generated after the build task, that usually means it's meant to be used in a build. And generally, such files are generated after lots of obfuscations and optimizations by the build task. Ideally, you should not even be testing this file. Is this abc.js a combination of lots of other JS files in your project? If yes, then you should be testing those files.
    – maazadeeb
    Commented May 22, 2017 at 2:31
  • Why don't you require the actual files which contains the contents of abc.js, or run the tests after the build? What is the problem?
    – T J
    Commented May 22, 2017 at 10:08
  • @MaazSyedAdeeb, @T J - Thanks for responding. This is issue is happened because of some configuration. I did configuration changes for abc.js file to generate it in required location so that it is available for specs and it is fixed now. Commented Jun 25, 2017 at 14:49

0