occ*_*asl 5 mocha.js node.js istanbul
关于使用伊斯坦布尔进行集成测试的报道很少。当我通过摩卡测试时,我得到了No coverage information was collected, exit without writing coverage information。
我要做的第一件事是检测所有源代码:
? istanbul instrument . -o .instrument
Run Code Online (Sandbox Code Playgroud)
就我而言,这是一种Docker化的REST微服务,我编写了Mocha测试以对其进行运行以验证其一旦部署。我期望伊斯坦布尔能为我提供该Node服务的源代码覆盖范围。
第二步,我执行此命令以在我的检测代码上运行节点:
? istanbul cover --report none .instrument/server.js
Run Code Online (Sandbox Code Playgroud)
之后,我使用我的主src目录中的以下内容运行我的测试,如下所示(带有结果):
? istanbul cover --report none --dir coverage/unit node_modules/.bin/_mocha -- -R spec ./.instrument/test/** --recursive
swagger-tests
#createPet
? should add a new pet (15226ms)
#getPets
? should exist and return an Array (2378ms)
? should have at least 1 pet in list (2500ms)
? should return error if search not name or id
? should be sorted by ID (3041ms)
? should be sorted by ID even if no parameter (2715ms)
? should be only available pets (2647ms)
#getPetsSortedByName
? should be sorted by name (85822ms)
#deletePet
? should delete a pet (159ms)
9 passing (2m)
No coverage information was collected, exit without writing coverage information
Run Code Online (Sandbox Code Playgroud)
当我跑步时istanbul report,显然没有什么可报告的。
我想念什么?
请参见该项目的开发分支以重现问题。
伊斯坦布尔的老板帮我解决了这个问题。我能够通过执行以下步骤来让事情顺利进行:
--handle-sigint并删除该标志--report none./node_modules/.bin/_mocha -R spec ./test/** --recursiveopen coverage/lcov-report/index.html| 归档时间: |
|
| 查看次数: |
2043 次 |
| 最近记录: |