Istanbul instrumenter loader无法找到Angular2组件的源映射。

时间:2016-10-22 13:05:56

标签: angular webpack karma-runner karma-jasmine karma-coverage

我试图通过关注来自网上的各种来源,使用业力,茉莉,webpack来建立angular2脚手架,以便更深入地了解。

我使用istanbul-instrumenter-loader进行业力报道报道。

当我运行npm test时,我得到以下输出:

ksharifbd:provat Admin$ npm test

> provat@0.0.1 test /Users/Admin/Downloads/kamal/development/self/provat
> karma start ./testconfig/karma/karma.conf.js --browsers Chrome

root directory: /Users/Admin/Downloads/kamal/development/self/provat
source directory: /Users/Admin/Downloads/kamal/development/self/provat/src

webpack: bundle is now VALID.
webpack: bundle is now INVALID.
ts-loader: Using typescript@2.0.3 and /Users/Admin/Downloads/kamal/development/self/provat/tsconfig.json
22 10 2016 18:48:15.719:WARN [karma]: No captured browser, open http://localhost:9876/

webpack: bundle is now VALID.
22 10 2016 18:48:15.741:INFO [karma]: Karma v1.3.0 server started at http://localhost:9876/
22 10 2016 18:48:15.742:INFO [launcher]: Launching browser Chrome with unlimited concurrency
22 10 2016 18:48:15.859:INFO [launcher]: Starting browser Chrome
22 10 2016 18:48:17.420:INFO [Chrome 54.0.2840 (Mac OS X 10.10.4)]: Connected on socket /#m-tmeGM-JMz_OSU4AAAA with id 80103692
Chrome 54.0.2840 (Mac OS X 10.10.4): Executed 1 of 1 SUCCESS (0.129 secs / 0.104 secs)
Error: Could not find source map for: "/Users/Admin/Downloads/kamal/development/self/provat/src/modules/greetings/component/greetings.component.ts"
at /Users/Admin/Downloads/kamal/development/self/provat/node_modules/remap-istanbul/lib/remap.js:257:11
at Array.forEach (native)
at /Users/Admin/Downloads/kamal/development/self/provat/node_modules/remap-istanbul/lib/remap.js:214:22
at Array.forEach (native)
at remap (/Users/Admin/Downloads/kamal/development/self/provat/node_modules/remap-istanbul/lib/remap.js:213:12)
at RemapCoverageReporter.onCoverageComplete (/Users/Admin/Downloads/kamal/development/self/provat/node_modules/karma-remap-coverage/remap-coverage.js:23:23)
at Server.<anonymous> (/Users/Admin/Downloads/kamal/development/self/provat/node_modules/karma/lib/events.js:13:22)
at emitTwo (events.js:106:13)
at Server.emit (events.js:191:7)
at InMemoryReport.writeReport (/Users/Admin/Downloads/kamal/development/self/provat/node_modules/karma-coverage/lib/in-memory-report.js:14:22)
at writeReport (/Users/Admin/Downloads/kamal/development/self/provat/node_modules/karma-coverage/lib/reporter.js:68:16)
at /Users/Admin/Downloads/kamal/development/self/provat/node_modules/karma-coverage/lib/reporter.js:290:11
at Array.forEach (native)
at Collection.forEach (/Users/Admin/Downloads/kamal/development/self/provat/node_modules/karma/lib/browser_collection.js:93:21)
at /Users/Admin/Downloads/kamal/development/self/provat/node_modules/karma-coverage/lib/reporter.js:247:16
at Array.forEach (native)

=============================== Coverage  summary===============================
Statements   : 82.35% ( 14/17 )
Branches     : 48.28% ( 14/29 )
Functions    : 100% ( 4/4 )
Lines        : 91.67% ( 11/12 )
================================================================================

我没有发布多个文件的输出,而是放了所有代码in Github with README

我们非常感谢您的帮助。

1 个答案:

答案 0 :(得分:4)

我遇到了同样的问题,&#34; istanbul-instrumenter-loader&#34;存在问题,降级到版本&#34; ^ 0.2.0&#34;的工作原理。

更改您的package.json并重新安装包

npm install -g element-finder

elfinder -s ".layout-fluid #sidebar" -i ".tmp, dist" -x "html, php"

npm un  istanbul-instrumenter-loader --save-dev

以下是其中一个文件

的范围

enter image description here