2017-01-17 2 views
1

karma-coverage로 lcov 리포터를 지원하려고합니다. 내가 필요한 보고서를 얻고있다karma-coverage : TypeError : 정의되지 않은 'split'속성을 읽을 수 없습니다.

ERROR [coverage]: TypeError: Cannot read property 'split' of undefined 
    at HtmlReport.writeDetailPage ({path}\node_modules\istanbul\lib\report\html.js:413:33) 

하지만,이 오류가 내 빌드를 실패 : 나는 오류가 계속

coverageReporter: { 
     dir: 'reports/', 
     reporters: [ 
      { type: 'in-memory' }, 
      { type: 'lcov', subdir: 'report-lcov' }, 
     ] 

    }, 

:이처럼 내 카르마 설정을 수정했습니다. 이 문제를 해결할 방법이 있습니까?

답변

0

다른 패키지를 사용하여이 문제를 해결할 수있었습니다. karma-remap-istanbul. 웹팩 테스트 구성에

변경 Karma.conf.js

에서
remapIstanbulReporter: { 
     remapOptions: {}, //additional remap options 
     reports: { 
     'text-summary': null, // to display summary results on console 
     json: 'coverage/coverage.json', 
     lcovonly: 'coverage/lcov.info', 
     html: 'coverage/html/', 
     } 
    }, 
    reporters: [ 'mocha', 'coverage', 'karma-remap-istanbul'], 

변경. 나는

{ 
      enforce: 'post', 
      test: /\.(js|ts)$/, 
      loader: 'sourcemap-istanbul-instrumenter-loader', 
      include: helpers.root('src'), 
      exclude: [ 
      /\.(e2e|spec)\.ts$/, 
      /node_modules/ 
      ] 
     } 

내가 원활 lcov 보고서를 생성 할 수 있었다 카르마 매핑 변경 커버리지 지원 로더 sourcemap-istanbul-instrumenter-loader 대신 이스탄불 - intrumenter 로더를 추가했다.

다른 사람들이 같은 문제에 직면 할 수 있기를 바랍니다.

관련 문제