2017-03-16 2 views
1

angular2의 구성 요소에 대한 단위 테스트를 작성하려고합니다. 스택은 Visual Studio IDE와 함께 angular2, karma, jasmine입니다. Gulp를 통해 단위 테스트를 실행하는 동안 발생한 예외를 아래에서 찾으십시오.angular 2, karma, jasmine 404 찾을 수 없음 문제

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

답변

관련 문제