--- UPDATE ---
So I updated my task and now I have the following, the problem is that when it gets into the spec the first line is the following
import {Injector, provide} from "angular2/core";
Unfortunately this is not referencing the node_modules/angular2 directory but rather the project root !!!
var jasmine = require('gulp-jasmine');
var System = require('systemjs');
gulp.task('newtest', () => {
System.config({
baseURL: "/",
transpiler: 'typescript',
defaultJSExtensions: true,
path: {
"node_modules*": "node_modules/*"
},
packages: {
"app": {
"defaultExtension": "js"
}
},
maps:{
"angular2": "/node_modules/angular2",
},
});
Promise.all([
System.import('app/assets/services/config.service.spec'),
]).then(function(){
gulp.src(['app/assets/services/config.service.spec'])
.pipe(jasmine())
}).catch(console.error.bind(console));
});
--- OLD ---
So I may be new to this thing, but I am trying to use gulp to build, lint and test my demo solution. The app is using Angular 2, Gulp, SystemJS, Gulp-tslint and Gulp-Jasmine, however I am unable to get the Gulp-Jasmine to run without falling over. It complains with the following:
events.js:141
throw er; // Unhandled 'error' event
^
TypeError: Invalid System.register call. Anonymous System.register calls can only be made by modules loaded by SystemJS.import and not via script tags.
at SystemJSNodeLoader. (D:\ng2demo\node_modules\systemjs\dist\system.src.js:2981:17)
at SystemJSNodeLoader. (D:\ng2demo\node_modules\systemjs\dist\system.src.js:3655:29)
at SystemJSNodeLoader. (D:\ng2demo\node_modules\systemjs\dist\system.src.js:4142:33)
at SystemJSNodeLoader.reduceRegister_ (D:\ng2demo\node_modules\systemjs\dist
\system.src.js:4142:33)
at SystemJSNodeLoader.pushRegister_ (D:\ng2demo\node_modules\systemjs\dist\system.src.js:2699:14)
at SystemJSNodeLoader.SystemJSLoader.register (D:\ng2demo\node_modules\syste
mjs\dist\system.src.js:2937:10)
at Object. (D:\ng2demo\app\assets\services\config.service.spec.js
:4:8)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
The JS file it is attempting to run is a spec written in TypeScript and transpiled to JS with gulp-typescript. So the top line of the file is:
System.register(['angular2/core', 'angular2/http', 'angular2/http/testing',
./config.service'], function(exports_1, context_1) {
//Do Stuff
});
It is this line it has a problem with, any ideas?
it appears you are missing a
'
in this line:should be: