获取有关angular2 404 /测试 [英] Getting a 404 on angular2/testing
本文介绍了获取有关angular2 404 /测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在angular2 /测试尽快得到一个404,因为我插入此行到我
规范文件。
I am getting a 404 on angular2/testing as soon as i insert this line into my spec file.
import {
iit,
it,
inject,
injectAsync,
beforeEachProviders,
fakeAsync,
tick
} from 'angular2/testing';
这是我的身体里面的标签code在用户tests.html
This is my code inside body tag in user-tests.html
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="node_modules/angular2/bundles/http.dev.js"></script>
<script src="node_modules/angular2/bundles/router.dev.js"></script>
<script>
System.config({
packages: {
'app': {defaultExtension: 'js'}
}
});
System.import('app/components/user.spec')
.then(window.onload)
.catch(console.error.bind(console));
</script>
是否有任何其他要安装的软件包,以便在角2测试?
我已经安装了每angular2文档Jamsine核心。
Is there any other packages to install to enable testing in angular 2 ? I have installed Jamsine-core per angular2 docs.
npm install jasmine-core --save-dev --save-exact
谢谢!
推荐答案
在使用SystemJS(按文档),则需要单独添加软件包。这是必要的每一个模块:HTTP,路由器和测试
When using SystemJS (as per docs), you need to add the bundles seperately. This is necessary for every module : http, router and testing.
在你的情况,你需要添加 testing.dev.js
捆绑。
In your case you need to add testing.dev.js
bundle.
<script src="node_modules/angular2/bundles/angular2-polyfills.src.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="node_modules/angular2/bundles/http.dev.js"></script>
<script src="node_modules/angular2/bundles/router.dev.js"></script>
<script src="node_modules/angular2/bundles/testing.dev.js"></script>
这篇关于获取有关angular2 404 /测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文