【发布时间】:2015-05-12 05:12:22
【问题描述】:
目前我们运行我们的 karma/jasmine 单元测试一个 gulp 任务:gulp test
我们正试图弄清楚如何让circleci 自动运行我们的测试。我尝试在 circle.yml 文件的test: 部分下添加gulp test,但得到gulp: command not found。但是如果我尝试像pwd 这样的基本操作,我会得到同样的错误。很明显我做错了什么。
我认为使用 package.json 中的 scripts 属性可以实现相同的结果,因为 circleci 会自动运行,但我不知道该怎么做。
这是我们的 circle.yml 文件...
dependencies:
override:
- echo PHP rules
test:
override:
- gulp test #this doesnt work!
deployment:
development:
branch: dev
heroku:
appname: ourapp
这里是 package.json...
{
"name": "ourapp",
"private": true,
"description": "An app",
"main": "index.js",
"dependencies": {
"gulp": "~3.8.5"
},
"devDependencies": {
"karma": "~0.12.31",
"karma-chrome-launcher": "~0.1.7",
"jasmine-core": "~2.2.0",
"karma-jasmine": "~0.3.5",
"karma-firefox-launcher": "~0.1.4",
"karma-ie-launcher": "~0.1.5",
"karma-opera-launcher": "~0.1.0",
"karma-phantomjs-launcher": "~0.1.4",
"gulp": "~3.8.10",
"gulp-karma": "0.0.4",
"karma-coverage": "~0.2.7"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "The A Team"
}
以防万一有用,这里是 gulp 任务...
gulp.task('test', function(){
return gulp.src(testFiles)
.pipe(karma({
configFile: 'karma.conf.js',
action: 'run' //change to watch if you want to auto-run
}))
.on('error', function(err){
throw err;
})
});
为了保持一致性,我认为最好的办法是让 circleci 运行 gulp 任务,但如果我们必须手动运行 karma ... 也没关系。
【问题讨论】:
标签: node.js unit-testing continuous-integration karma-runner circleci