2016-03-24 23 views
1

私はangle2アプリのユニットテストをしようとしています。シンプルなテストの合格だが、私はまだ 'Uncaught ReferenceError:requireが定義されていない'というエラーが発生する開発ツールを開いている。 'testing.ts.9:。ライブラリをどのようにロードする必要がありますか?このエラーは表示されなくなりますか?トラブルの読み込みangular2/testing.js

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="UTF-8"> 
    <title>Testing Jasmine</title> 
    <link rel="stylesheet" href="../node_modules/jasmine-core/lib/jasmine-core/jasmine.css"> 
    <script src="../node_modules/jasmine-core/lib/jasmine-core/jasmine.js"></script> 
    <script src="../node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js"></script> 
    <script src="../node_modules/jasmine-core/lib/jasmine-core/boot.js"></script> 

    <script src="../node_modules/es6-shim/es6-shim.min.js"></script> 
    <script src="../node_modules/systemjs/dist/system-polyfills.js"></script> 
    <script src="../node_modules/angular2/bundles/angular2-polyfills.js"></script> 
    <script src="../node_modules/systemjs/dist/system.src.js"></script> 
    <script src="../node_modules/rxjs/bundles/Rx.js"></script> 
    <script src="../node_modules/angular2/bundles/angular2.dev.js"></script> 
    <script src="../node_modules/angular2/bundles/router.js"></script> 
    <script src="../node_modules/angular2/bundles/testing.dev.js"></script> 
    <script src="../node_modules/angular2/testing.js"></script> 
</head> 

<body> 
<!-- #1. add the system.js library --> 

<script> 
    // #2. Configure systemjs to use the .js extension 
    //  for imports from the app folder 
    System.config({ 

     packages: { 
      '../app': {defaultExtension: 'js'} 
     } 
    }); 

    // #3. Import the spec file explicitly 
    System.import('hero.spec.js') 
      .then(window.onload) 
      .catch(console.error.bind(console)); 
</script> 
</body> 
</html> 

答えて

0

このライブラリは必要ありませんでした。私は輸入品とラインを削除し、何も壊れませんでした。だから私はそれが本当に必要ではなかったと思う。

<script src="../node_modules/angular2/testing.js"></script> 
関連する問題