I'm trying to set up karma to work with Require.js now for a few days (and then use it later with angular), and it was amazingly unpleasant. Here is what this file tree looks like for this example:
$ tree . |-- public | |-- index.html | |-- src | |-- app.js | `-- main.js |-- config | |-- karma.conf.js |-- lib | |-- jquery.js | |-- require.js | `-- underscore.js |-- src | |-- app.js | `-- main.js `-- test |-- appSpec.js `-- test-main.js
Note:
This repository I'm working on is a clone of the one used in the karma requirejs example . The only difference between the garmubs example code is the karma example , and my code is 3 changes in the file directory structure:
So. Right now, for everything to work, it would be wise that you have to:
requirejs.config ({
// Karma serves files from '/base' baseUrl: '/base/src',
to
requirejs.config({ // Karma serves files from '/base' baseUrl: '../base/src',
but it seems that no matter what I do, I keep getting the same error:
ERROR: 'There is no timestamp for /base/src/app.js!' Uncaught Error: Script error for: app http:
or
Uncaught Error: Script error for: jquery http://requirejs.org/docs/errors.html#scripterror at /node_modules/requirejs/require.js:141 Uncaught Error: Script error for: underscore http://requirejs.org/docs/errors.html#scripterror at /node_modules/requirejs/require.js:141
source share