我的开源项目的TravisCI构建已经过去了,我现在正在尝试集成gulp coveralls。在Coveralls.io上,找不到我的存储库的构建,即使Travis构建已经成功运行,因为我将我的存储库添加到了Coverall。
'There have been no builds for this repo.'当我尝试运行我的gulp coveralls任务时,我得到这个错误:
'Repo token could not be determined. Continuing without it.'
Error in plugin 'gulp-coveralls'
Bad response:422 {"message":"Couldn't find a repository matching this job.","error":true}
at handleError (/Users/sarah.green/angular-embedly/node_modules/gulp-coveralls/index.js:11:30)
at sendToCoverallsCallback (/Users/sarah.green/angular-embedly/node_modules/gulp-coveralls/index.js:19:9)
at /Users/sarah.green/angular-embedly/node_modules/gulp-coveralls/index.js:31:13
at Request._callback (/Users/sarah.green/angular-embedly/node_modules/gulp-coveralls/node_modules/coveralls/lib/sendToCoveralls.js:7:5)
at Request.self.callback (/Users/sarah.green/angular-embedly/node_modules/gulp-coveralls/node_modules/coveralls/node_modules/request/index.js:142:22)
at Request.EventEmitter.emit (events.js:98:17)
at Request.<anonymous> (/Users/sarah.green/angular-embedly/node_modules/gulp-coveralls/node_modules/coveralls/node_modules/request/index.js:856:14)
at Request.EventEmitter.emit (events.js:117:20)
at IncomingMessage.<anonymous> (/Users/sarah.green/angular-embedly/node_modules/gulp-coveralls/node_modules/coveralls/node_modules/request/index.js:808:12)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:919:16
at process._tickCallback (node.js:419:13)这是我到目前为止所得到的:
在package.json中我的开发依赖项中的gulp coveralls
gulpfile.js:
var coveralls = require('gulp-coveralls');
...
gulp.task('coveralls', function () {
gulp.src('coverage/**/lcov.info')
.pipe(coveralls());
});karma.conf.js:
coverageReporter: {
type : 'lcov',
dir : 'coverage/'
}Github:https://github.com/lithiumtech/angular-embedly
我使用Karma和PhantomJS来运行我的测试。文件coverage/lcov.info肯定正在生成。知道是怎么回事吗?
发布于 2014-09-02 07:46:35
莎拉,
您缺少的是一个coveralls存储库令牌。您必须转到coveralls.io并使用您的GitHub帐户创建登录。这将把你所有的回收物都放到工作服里。然后,对于要使用工作服的存储库,您可以通过单击“关闭”开关来打开工作服。
现在点击“查看套装”按钮,它将显示您的repo密钥。然后,您可以通过创建.coveralls.yml文件并将密钥复制到该文件中来对其进行设置。这应该可以解决您的问题。
发布于 2014-12-18 01:45:49
也许您的.coveralls.yml文件中有一个错误。如果您使用的是Travis CI,请尝试以下操作:
service_name: travis-ci
repo_token: token_given如果你使用的是Travis Pro:
service_name: travis-pro
repo_token: token_given我希望这将是有用的。
发布于 2015-05-26 15:40:08
对于在travis-ci.org中运行的GitHub构建,您不需要在.coveralls.yml文件中提供服务名称,只需要令牌。您也不需要在Travis中通过构建,只需要成功生成LCOV数据和一个发送数据的插件即可。
在使用gulp.src从文件中读取LCOV数据时,我遇到了一个问题,即LCOV数据不能正确地发送到coveralls。它最终工作的唯一方法是如果LCOV数据直接发送到插件,而不是首先使用中间文件将其存储到。
为了将LCOV数据通过管道传输到gulp-coveralls并生成JSON/HTML报告,最后我求助于lazy-pipe来创建可重用的步骤。
完整的项目可以在GitHub的angular-logger上找到。
// .coveralls.yml
repo_token: the_tokenvar jasmine = require('gulp-jasmine');
var cover = require('gulp-coverage');
var coveralls = require('gulp-coveralls');
var lazypipe = require('lazypipe');
(..)
// gulpfile.js
var testAndGather = lazypipe()
.pipe(cover.instrument, {
pattern: ['src/**/*.js'],
debugDirectory: 'debug'
})
.pipe(jasmine, {includeStackTrace: true})
.pipe(cover.gather);
gulp.task('test', ['build'], function () {
gulp.src('spec/**/*spec.js')
.pipe(testAndGather())
.pipe(cover.format(['html']))
.pipe(gulp.dest('reports'));
});
gulp.task('travis', ['build'], function () {
gulp.src('spec/**/*spec.js')
.pipe(testAndGather())
.pipe(cover.format(['lcov']))
.pipe(coveralls()); // directly pipe into coveralls
});使用:
"gulp-jasmine": "~2.0.1",
"gulp-coverage": "~0.3.35",
"gulp-coveralls": "~0.1.4",
"lazypipe": "~0.2.3"https://stackoverflow.com/questions/25434794
复制相似问题