2016-04-23 13 views
0

とエラーになります--- UPDATE ---一息-ジャスミンはsystemjs

は、だから、私は、タスクを更新し、今私は、次のものが、問題は、それが仕様に入ったとき、最初の行は次のよう

であるということです
import {Injector, provide} from "angular2/core"; 

残念ながら、これはnode_modules/angular2ディレクトリを参照するのではなく、プロジェクトルート!!!

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

だから私はこの事に新しいかもしれないが、私は、構築糸くずや私のデモソリューションをテストするためにがぶ飲みを使用しようとしています。アプリはAngular 2、Gulp、SystemJS、Gulp-tslint、Gulp-Jasmineを使用していますが、Gulp-Jasmineを落とさずに走らせることはできません。それは次のように文句を言う:

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) 

JSはそれを実行しようとしているファイルスペック活字体で書かれており、グッ-typescriptですとJSにtranspiledです。ファイルの一番上の行は次のとおりです。

System.register(['angular2/core', 'angular2/http', 'angular2/http/testing', 
./config.service'], function(exports_1, context_1) { 
//Do Stuff 
}); 

これは問題ではありますか?

+1

、ちょうど4つのスペース(またはそれを強調表示し、使用してコード/エラーをインデント制御+ k /コマンド+ k)。 – Laurel

答えて

0

あなたがこの行の'が欠落している表示されます。

./config.service'], function(exports_1, context_1) { 

は次のようになります。将来的には

System.register(['angular2/core', 'angular2/http', 'angular2/http/testing', 
'./config.service'], function(exports_1, context_1) { 
//Do Stuff 
}); 
+0

ありがとうございましたJeff、それは私の代わりに単にタイプミスでした:とにかくPはコードをチェックして、それを含んでいます。他のアイデアはありますか? SystemJSではなくSystemJSをモジュールローダーとして使うことを勧めている人もいますが、GoogleのデベロッパーチームはSystemJSを使用していますので、Gulp-Jasmineがそれを処理すると思います。私はnpmテストを実行すると動作しますが、gulpは問題を抱えています。私が紛失しているものは何ですか? – HeavenlyHost