Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

test not running on karma/jasmine/require.js 'There is no timestamp for *lib*!' error

I change the code, extend some functionality and add new unittest for that. Now, when I run my unit tests with karma (test framework - jasmine), it throw me an error

'There is no timestamp for /libs/angular-bootstrap/ui-bootstrap-tpls.js!'
Uncaught Error: Script error for: angular-bootstrap
http://requirejs.org/docs/errors.html#scripterror
at http://localhost:9876/base/node_modules/karma-requirejs/lib/require.js?1379984163000:138

What I'm doing wrong?

like image 257
Ph0en1x Avatar asked Sep 25 '13 22:09

Ph0en1x


3 Answers

It was my mistake completely. when using karma-requirejs you have main-test.js file where configure how to require.js get the files. I add reference to angular-bootstrap with mistake, that's why require.js couldn't find this file and throwing this mistake. So in my case this error means wrong file name provided.

like image 126
Ph0en1x Avatar answered Oct 18 '22 21:10

Ph0en1x


It can be because it cannot access your source file. You should configure karma to serve scripts where require will look for them. For example have the config in the karma conf

files:[{pattern: 'node_modules/**/*.js', included:false}]
like image 20
kisp Avatar answered Oct 18 '22 22:10

kisp


The question is old, the OP already solved his problem by now, but I'll add my two cents:

From the error message (end of the first error line) we can conclude that you were including a paths (or deps) file in main-test.js with the .js extension. In RequireJS, you need to call the file names without the extension, so your paths (or deps) would look more or less like this:

paths: {
    'ui-bootstrap': 'libs/angular-bootstrap/ui-bootstrap-tpls' // <- without the extension
}
like image 1
Jairo Avatar answered Oct 18 '22 21:10

Jairo