vendredi 27 mai 2016

Require.js looking for Angular app relative to unit test folder

I am attempting to write unit tests for my Angular app, which uses require.js, and running into this specific error, as stated in the console.

As the screen shot below describes, my test folder resides in root/tests/UnitTest, whereas my Angular app resides in root/app:

enter image description here

And here is the scrip tag which contains the require.js src value and the data-main entry point in both my unit tests and the app:

SpecRunner.html:        <script src="./../../Scripts/libs/require.js" data-main="./../../Scripts/appGlobal/main"></script>
Angular app Index.html: <script src="Scripts/libs/require.js" data-main="Scripts/appGlobal/main"></script>

This works fine, obviously, when I run my Angular app, however, when I run my unit tests (SpecRunner.html) I get the following console errors for each file in the app folder (essentially my entire Angular app):

require.js:1903 GET http://ift.tt/1U0QFAT req.load @ require.js:1903context.load @ require.js:1647Module.load @ require.js:828Module.fetch @ require.js:818Module.check @ require.js:848Module.enable @ require.js:1151context.enable @ require.js:1519(anonymous function) @ require.js:1136(anonymous function) @ require.js:132each @ require.js:57Module.enable @ require.js:1098Module.init @ require.js:782(anonymous function) @ require.js:1424
require.js:166 Uncaught Error: Script error for: services/privilegesService
http://ift.tt/1TNjzZb @ require.js:166context.onScriptError @ require.js:1689
require.js:1903 GET http://ift.tt/1U0QPIk 404 (Not Found)req.load @ require.js:1903context.load @ require.js:1647Module.load @ require.js:828Module.fetch @ require.js:818Module.check @ require.js:848Module.enable @ require.js:1151context.enable @ require.js:1519(anonymous function) @ require.js:1136(anonymous function) @ require.js:132each @ require.js:57Module.enable @ require.js:1098Module.init @ require.js:782(anonymous function) @ require.js:1424
require.js:166 Uncaught Error: Script error for: services/routeResolver

Any idea how to resolve these paths so both my Angular app and unit tests can run without incident?

Aucun commentaire:

Enregistrer un commentaire