1
私はangular2のコンポーネントの単体テストを作成しようとしています。スタックはangle2、karma、jasmineでVisual StudioはIDEです。 Gulpを使用して単体テストを実行している間に発生した例外を以下に示します。angular2、karma、jasmine 404 not found問題
**16 03 2017 18:04:28.169:DEBUG [middleware:source-files]: Fetching E:/TestProject/app/component/SampleComponent
16 03 2017 18:04:28.170:WARN [web-server]: 404: /base/app/component/SampleComponent
Chrome 56.0.2924 (Windows 7 0.0.0) ERROR
{
"originalStack": "Error: Error: XHR error (404 Not Found) loading app/component/SampleComponent\n\tError loading app/component/SampleComponent as \"./SampleComponent\" from app/component/SampleComponent.spec.js",
"zoneAwareStack": "Error: Error: XHR error (404 Not Found) loading app/component/SampleComponent\n\tError loading app/component/SampleComponent as \"./SampleComponent\" from app/component/SampleComponent.spec.js",
"originalErr": {
"originalStack": "Error: XHR error (404 Not Found) loading app/component/SampleComponent",
"zoneAwareStack": "Error: XHR error (404 Not Found) loading app/component/SampleComponent"
}
}
Chrome 56.0.2924 (Windows 7 0.0.0) ERROR
{
"originalStack": "Error: Error: XHR error (404 Not Found) loading app/component/SampleComponent\n\tError loading app/component/SampleComponent as \"./SampleComponent\" from app/component/SampleComponent.spec.js",
"zoneAwareStack": "Error: Error: XHR error (404 Not Found) loading app/component/SampleComponent\n\tError loading app/component/SampleComponent as \"./SampleComponent\" from app/component/SampleComponent.spec.js",
"originalErr": {
"originalStack": "Error: XHR error (404 Not Found) loading app/component/SampleComponent",
"zoneAwareStack": "Error: XHR error (404 Not Found) loading app/component/SampleComponent"
}
}
16 03 2017 18:04:28.258:DEBUG [karma]: Run complete, exiting.
16 03 2017 18:04:28.259:DEBUG [launcher]: Disconnecting all browsers**
マイフォルダ構造は、テストはコンポーネントフォルダ自体内で使用可能なアプリの\コンポーネント
です。蒸留されたjsの関連コードは次のとおりです。
const Component_1 = require("./SampleComponent");
const testing_1 = require("@angular/core/testing");
これを助けてくれる人がいらっしゃいます。
おかげ
TTV