Jasmine 在angular2/测试中获得404

Jasmine 在angular2/测试中获得404,jasmine,angular,Jasmine,Angular,一旦我把这条线插入我的电脑,我就会在angular2/测试中得到404 规格文件 import { iit, it, inject, injectAsync, beforeEachProviders, fakeAsync, tick } from 'angular2/testing'; 这是我在user-tests.html中的body标记内的代码 <script src="node_modules/systemjs/dist/

一旦我把这条线插入我的电脑,我就会在angular2/测试中得到404 规格文件

import {
    iit,
    it,
    inject,
    injectAsync,
    beforeEachProviders,
    fakeAsync,
    tick
} from 'angular2/testing';
这是我在user-tests.html中的body标记内的代码

  <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>
谢谢

使用SystemJS时(根据文档),需要单独添加捆绑包。这对于每个模块都是必要的:http、路由器和测试

在您的情况下,您需要添加
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>


您必须添加
testing.dev.js
捆绑包。谢谢您,先生!+1,但现在在使用类装饰器时需要获取不同的错误反射元数据垫片。您还必须添加
angular2 polyfills.js
。该捆绑包包含zone.js和reflect元数据。一定要把它放在所有angular2包之上。谢谢你解决了这个问题@埃里克·马丁内斯:快速提问。我在RxJs上也得到了404。我有内体标签。我是否也需要将RxJs加载到System.Config?
<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>