I'm trying to figure it out for few hours and I guess that it has to do with my misconfigured requirejs file ('test.main.js') but I'm not quite sure so can someone please explain to me what's wrong?
If you need more information from me I'd be happy to provide it.
Here is the output of the stack trace.
Eyal Shilony@LIONKING /d/Projects/Code/Development/tsToolkit
$ ./karma.sh start
INFO [karma]: Karma v0.12.16 server started at http://localhost:8380/
INFO [IE 11.0.0 (Windows 7)]: Connected on socket GCSNAkUAY24F-MN7dkGQ with id manual-4464
IE 11.0.0 (Windows 7) ERROR: 'There is no timestamp for /base/src/tests/core/types.tests!'
WARN [web-server]: 404: /base/src/tests/core/types.tests
IE 11.0.0 (Windows 7) ERROR
Script error for: /base/src/tests/core/types.tests
http://requirejs.org/docs/errors.html#scripterror
at D:/Projects/Code/Development/tsToolkit/node_modules/requirejs/require.js:141
Here is the directory structure I'm using atm.
.
|-- WebEssentials-Settings.json
|-- jake.sh
|-- jakefile.js
|-- karma.sh
|-- node_modules
| |-- jake
| | |-- Jakefile
| | |-- Makefile
| | |-- README.md
| | |-- bin
| | |-- lib
| | |-- node_modules
| | |-- package.json
| | `-- test
| |-- jasmine-node
| | |-- Gruntfile.coffee
| | |-- LICENSE
| | |-- README.md
| | |-- bin
| | |-- bower.json
| | |-- index.js
| | |-- lib
| | |-- node_modules
| | |-- package.json
| | |-- scripts
| | |-- spec
| | `-- src
| |-- karma
| | |-- CHANGELOG.md
| | |-- LICENSE
| | |-- README.md
| | |-- bin
| | |-- config.tpl.coffee
| | |-- config.tpl.js
| | |-- config.tpl.ls
| | |-- karma-completion.sh
| | |-- lib
| | |-- node_modules
| | |-- package.json
| | |-- requirejs.config.tpl.coffee
| | |-- requirejs.config.tpl.js
| | `-- static
| |-- karma-jasmine
| | |-- LICENSE
| | |-- README.md
| | |-- lib
| | `-- package.json
| |-- karma-requirejs
| | |-- LICENSE
| | |-- README.md
| | |-- lib
| | `-- package.json
| |-- karma-requirejs-preprocessor
| | `-- index.js
| |-- requirejs
| | |-- README.md
| | |-- bin
| | |-- package.json
| | `-- require.js
| `-- shelljs
| |-- LICENSE
| |-- README.md
| |-- bin
| |-- global.js
| |-- make.js
| |-- package.json
| |-- scripts
| |-- shell.js
| `-- src
|-- scratchpad.txt
|-- src
| |-- app.main.js
| |-- app.main.js.map
| |-- app.main.ts
| |-- framework
| | |-- core
| | |-- css
| | `-- widgets
| |-- index.html
| |-- libs
| | |-- jquery-2.1.0.js
| | |-- require.js
| | `-- typings
| |-- tests
| | |-- core
| | `-- test.main.js
| |-- tsToolkit.csproj
| |-- tsToolkit.csproj.user
| |-- web.Debug.config
| |-- web.Release.config
| `-- web.config
|-- tools
| |-- karma
| | |-- karma.conf.js
| | `-- karma.conf.js.back
| `-- mocha
| `-- mocha.ext.js
|-- tsToolkit.sln
|-- tsToolkit.sln.DotSettings.user
`-- tsToolkit.v12.suo
41 directories, 59 files
Here is the config file for Karma.
// Karma configuration
// Generated on Fri May 16 2014 08:27:07 GMT+0300 (Jerusalem Daylight Time)
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '../../',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine', 'requirejs'],
// list of files / patterns to load in the browser
files: [
{pattern: 'src/libs/*.js', included: false},
{pattern: 'src/framework/**/*.js', included: false},
{pattern: 'src/tests/**/*tests.js', included: false},
'src/tests/test.main.js'
],
// list of files to exclude
exclude: [
'src/app.main.js'
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
// web server port
port: 8380,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
});
};
and finally here is my 'test.main.js' file to setup requirejs for Karma.
var tests = [];
for (var file in window.__karma__.files) {
if (window.__karma__.files.hasOwnProperty(file)) {
if (/\.tests\.js$/.test(file)) {
tests.push(file.replace(/\.js$/, ""));
}
}
}
requirejs.config({
baseUrl: '/base',
deps: tests,
callback: window.__karma__.start
});
It tooks me few days to figure it out, the paths were incorrect all over the place both in my Karma configuration files and the requirejs 'tests.main.js' file.
So what I did was going to Karma - RequireJS tutorial, downloaded the project from github and basically restructure it bit by bit to understand why it doesn't work in my own project.
I had two recurring errors and both of them related to incorrect paths so I posted the full solution in another question that I asked at StackOverflow.
The solution is now available at GitHub.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With