Tag: 伊斯坦布尔

以编程方式使用伊斯坦布尔的最小代码

我想执行这个命令 istanbul cover node_modules/mocha/bin/_mocha dist/test 使用伊斯坦布尔程序化API。 但是文档并没有多说,除此之外,一切都是可能的,并链接到庞大的API文档。 我在互联网上找不到任何简短的例子。 我不想产生subprocess或使用NPM中的另一个模块。 我知道如何在没有覆盖的情况下以编程方式运行摩卡,所以这不是问题。

伊斯坦堡代码覆盖与摩卡咖啡testing与咖啡的脚本

我正在使用摩卡来运行纯粹在coffeescript中的testing。 我也希望能够使用伊斯坦布尔来生成代码覆盖率报告。 请注意,我在mocha.opts文件中使用了mocha选项–compilers coffee:coffee-script/register 。 我遇到的问题是,不包括需要其他coffeescript源文件的testing。 如果相反,我需要js文件,它覆盖的很好。 我错过了什么吗? 我的npm test命令是: istanbul test –report html -x 'vendor/**' _mocha 。 我使用npm test –coverage来执行伊斯坦布尔的覆盖实用程序。 下面是一个摩卡testing(./test/test.coffee)的示例: # Project # require ../src/main.coffee main = require('../src/main') # Chai chai = require('chai') assert = chai.assert should = chai.should() expect = chai.expect describe 'something', (done) -> describe "when given something", -> it "should […]

node.js伊斯坦布尔和茉莉花设置

我无法得到伊斯坦布尔与茉莉花一起工作: 这是我的目录结构 ttm-jira – package.json – spec – jira-spec.js 我的package.json看起来像这样: { "name": "ttm-jira", "version": "1.0.0", "description": "nodeJS module to provide access to the JIRA REST API", "author": { "name": "…", "url" : "…." }, "main": "jira.js", "private": true, "repository": { "type": "git", "url" : "https://……..git" }, "bugs": { "url" : "https://jira2………" }, "scripts": { "test" […]

如何忽略伊斯坦布尔覆盖范围内node.js中的所需文件

在我的代码中,我有var es = require('event-stream'); 在我的package.json中,我有 "scripts": { "test": "istanbul cover ./node_modules/mocha/bin/_mocha — -R spec", } 我只想覆盖我的主文件,但它也涵盖事件stream的文件,所以我得到的东西 =============================== Coverage summary =============================== Statements : 24.74% ( 757/3060 ) Branches : 5.42% ( 88/1625 ) Functions : 15.56% ( 70/450 ) Lines : 25.37% ( 735/2897 ) ================================================================================ 有没有办法只覆盖我自己的代码?

噶 – 伊斯坦布尔 – 代码覆盖率报告path

我使用karma作为茉莉花testing赛跑者,与instanbul作为代码覆盖工具。 所有的作品完美,但有一个问题 – 有什么办法可以改变创build报告的path? 即对于Chrome我得到/coverage/Chrome%2035.0.1916%20(Windows%207)/index.html ; 我会更喜欢/coverage/Chrome/index.html 任何build议非常感谢。

使用伊斯坦布尔和摩卡来覆盖ES6的代码

我有用ES6编写的Node代码,通过发布mocha –harmonytesting。 testing很好 – 一切正常。 现在我想添加覆盖和伊斯坦布尔的混合,但我不断遇到遇到的第一个箭头函数的错误: No coverage information was collected, exit without writing coverage information c:\Users\Guy\Code\alpha-dev\tests\helpers.js:12 setTimeout(() => { ^ SyntaxError: Unexpected token ) at exports.runInThisContext (vm.js:73:16) at Module._compile (module.js:443:25) at Module._extensions..js (module.js:478:10) at Object.Module._extensions..js (c:\Users\Guy\Code\alpha-dev\node_modules\istanbul\lib\hook.js:101:13) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Module.require (module.js:365:17) 这是我的尝试: 安装伊斯坦布尔和谐(从git://github.com/gotwarlost/istanbul.git#harmony)作为我的开发依赖。 运行以下命令: "./node_modules/.bin/istanbul" cover "./node_modules/mocha/bin/_mocha" — –harmony tests […]

如何在基于Express的API上设置代码覆盖率?

我一直在这个问题一段时间,我不能让现有的解决scheme为我工作。 我有一个用Express.js编写的Node.js API。 我一直在使用Mocha,Chai和Supertest为API编写testing。 这些testing主要是集成testing。 一个testing可能看起来像: it('should fail to register a new user without the proper information', function(done) { api.post('/user') .send({}) .expect(400) .expect('Content-Type', /json/) .end(function(err, res) { should.exist(res.body); should.exist(res.body.error); should.not.exist(err); res.body.error.should.contain('Username'); res.body.error.should.contain('password'); done(); }); }); 实际的testing工作很好,但现在我需要能够查看这些testing的代码覆盖率。 我必须知道我没有做足够的testing。 我尝试过使用摩卡的testing范围: mocha -R html-cov –coverage > coverage.html 和伊斯坦布尔的: istanbul cover _mocha — -R spec –timeout 5000 两者都遭受同样的问题: 你看,这是一个示例路线(用户注册)。 […]

伊斯坦布尔的摩卡testing代码覆盖率

我正试图让伊斯坦布尔工作。 我在伊斯坦布尔运行结束时一直收到这个消息: 没有收集覆盖信息,没有写覆盖信息退出 我已经尝试了一切,我可以在网上find你可以看到: "scripts": { "start": "node ./bin/start.js", "test": "mocha test –no-timeouts", "debug_mocha": "node-debug –no-timeouts _mocha", "eslint": "eslint .", "jshint": "jshint –exclude ./node_modules .", "istanbul": "istanbul cover –include-all-sources –hook-run-in-context node_modules/.bin/_mocha — -u exports -R spec test/**/*", "istanbul2":"istanbul cover node_modules/.bin/_mocha — -u exports -R spec test/**/*", "istanbul1":"istanbul cover node_modules/.bin/_mocha — test/**/*", "istanbul0":"istanbul cover _mocha test/**/*.js", […]

如何使伊斯坦布尔生成所有我的源代码覆盖?

目前伊斯坦布尔只是生成我的testing中使用的文件的覆盖率,这是可以的,但似乎打破了有些覆盖面的目的。 我没有伊斯坦布尔configuration,并通过npm test与以下脚本string调用它: $ istanbul cover _mocha — -R dot –check-leaks –recursive test/ 有没有办法为我所有的源代码生成覆盖率?

在使用摩卡和伊斯坦布尔时不包括覆盖范围内的文件

如何使用摩卡和instanbul从覆盖率报告中排除文件夹和文件(按path)? 我想排除一个configuration,而不是 /*istanbul ignore next*/ 在每个文件中。 (Jenkins生成的报告使用) 谢谢,