Gulp-Jasmine 给出了 SystemJS 的错误
gulp-jasmine gives error with systemjs
--- UPDATE ---
所以我更新了我的任务,现在我有以下内容,问题是当它进入规范时,第一行如下
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));
});
---老---
所以我可能是这个东西的新手,但我正在尝试使用 gulp 来构建、lint 和测试我的演示解决方案。该应用程序正在使用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编写的规范,并使用gulp-typescript转译为JS。所以文件的第一行是:
System.register(['angular2/core', 'angular2/http', 'angular2/http/testing',
./config.service'], function(exports_1, context_1) {
//Do Stuff
});
就是这条线有问题,有什么想法吗?
您
似乎缺少此行中的'
:
./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
});
相关文章:
- Node.js v6.2.0类扩展不是函数错误
- Jquery菜单操作不稳定,定位不正确,存在一般错误
- document.open/document.write没有正确地清除chrome中的文档——这是chrome的错误吗
- 试图在引导模式内动态生成图表,得到offsetWidth错误
- 为什么会出现错误;未捕获的类型错误:undefined不是函数;
- 我如何修复包含在captcha的addthis中的错误
- 同样,同样的错误'ahorcado.js:26未捕获类型错误:无法读取属性'beginPath'
- 节点是否需要模块传递带有方括号的arg?这是个错误吗
- Webpack/Rect:遵循egghead.io教程,但出现错误:您可能需要一个合适的加载程序来处理此文件类型
- CKFinder 3为所选文件返回错误的URL
- 同位素库错误:未捕获错误无布局模式包装生产线8
- 铬:“;未捕获的语法错误:意外的标记:"
- 如何通过自己获得Chrome扩展的用户反馈/错误报告
- 相位器状态未捕获参考错误
- Gulp-Jasmine 给出了 SystemJS 的错误
- Webstorm SystemJS导入解析错误
- 使用Systemjs加载类时的类型错误
- JSPM 服务器错误:在 SystemJS 加载之外的文件发生更改
- 提前编译时出现SystemJS错误(NgZone没有提供程序)
- 在html中加载SystemJS会在PhantomJS中出现错误