【发布时间】:2016-09-04 10:54:04
【问题描述】:
Angular 版本 2.0.0-rc.6
在karma-test-shim.js (project on github)
Promise.all([
System.import('@angular/core/testing'),
System.import('@angular/platform-browser-dynamic/testing')
]).then(function (providers) {
var coreTesting = providers[0]; //undefined
var browserTesting = providers[1]; //all right
coreTesting.TestBed.initTestEnvironment(
browserTesting.BrowserDynamicTestingModule,
browserTesting.platformBrowserDynamicTesting());
}).then(function() {
// Finally, load all spec files.
// This will run the tests directly.
return Promise.all(
allSpecFiles.map(function (moduleName) {
return System.import(moduleName);
}));
}).then(__karma__.start, __karma__.error);
实验发现新的/node_modules/@angular/core/testing/index.d.ts 不导出值。
为什么我不能 System.import('@angular/core/testing') 但可以 System.import('@angular/core')?
附言
1.npm 测试
上的错误PhantomJS 2.1.1 (Linux 0.0.0) ERROR
{
"stack": "karma-test-shim.js:72:14\ninvoke@node_modules/zone.js/dist/zone.js:332:34\nrun@node_modules/zone.js/dist/zone.js:225:50\nnode_modules/zone.js/dist/zone.js:591:61\ninvokeTask@node_modules/zone.js/dist/zone.js:365:43\nrunTask@node_modules/zone.js/dist/zone.js:265:58\ndrainMicroTaskQueue@node_modules/zone.js/dist/zone.js:497:43\nrun@node_modules/core-js/client/core.js:4019:30\nnode_modules/core-js/client/core.js:4032:32\nflush@node_modules/core-js/client/core.js:4387:12",
"line": 72,
"sourceURL": "karma-test-shim.js"
}
【问题讨论】:
-
SystemJS 或网络没有错误吗?您如何在 SystemJS 配置中定义它?请注意,对于 UMD 捆绑包,有 a separate file for testing
-
@estus,错误被添加得更高。我在这个project 中没有看到任何与捆绑包相关的配置选项,我以它为例,我应该添加它们吗?如何? My project page
标签: javascript angular jasmine karma-jasmine