When I run Karma Tests in Angular2 i get the following error.
Uncaught TypeError: Unexpected anonymous System.register call. at http://localhost:9876/base/node_modules/systemjs/dist/system.src.js?38538ebca96bc7b222f7e7ba15943f173a485f6e:2885
I suppose its because the var System is currently not available. Even if its actually loaded. Does anyone have an idea why this is not working?
Here is my stripped down configuration:
C:\project\karma.conf.js
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine'],
files: [
'node_modules/systemjs/dist/system.src.js',
'node_modules/angular2/bundles/angular2.dev.js',
'tests/**/*Spec.js'
],
exclude: [
],
preprocessors: {
},
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: ['Chrome', 'Firefox'],
singleRun: false,
concurrency: Infinity
})
}
C:\project\tests\MyTestSpec.ts This one line is enough to trigger the error.
import {describe, expect, it, xit, inject, beforeEachProviders} from 'angular2/testing';
that renders to C:\project\tests\MyTestSpec.js and produces an error on the first occurance of System
System.register([], function(exports_1) {
return {
setters:[],
execute: function() {
}
}
});
//# sourceMappingURL=CmiCloudSpec.js.map
C:\project\tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"watch": true,
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}
C:\project\src\node_modules
contains the folders angular2 and systemjs as well as karma, karma-jasmine, jasmine-core and typescript