【发布时间】:2018-01-11 08:44:11
【问题描述】:
我正在尝试在 Bamboo 中为 Node.js 项目运行测试套件,但 Bamboo 无法识别我的测试套件
这是 Nodej.js 项目的结构:
Project
app
controller
model
routes
services
node_modules
test
controller
test1.js
//more tests
model
test1.js
//more tests
routes
test1.js
//more tests
services
test1.js
//more tests
package.json
//other files
我的 package.json 看起来像这样:
{
"dependencies": {
//dependencies
},
"devDependencies": {
"chai": "^4.1.0",
"growl": "^1.8.1",
"grunt-generate": "^0.3.2",
"gulp": "^3.9.0",
"gulp-concat": "^2.6.0",
"gulp-ng-annotate": "^2.0.0",
"gulp-uglify": "^2.1.2",
"mocha": "^3.4.2",
"mocha-bamboo-reporter": "*",
"sinon": "^2.3.8",
"supertest": "^3.0.0"
},
"scripts": {
"test": "mocha",
"forever-start": "forever start server.js -l -o -e",
"bamboo": "node node_modules/mocha/bin/mocha -R mocha-bamboo-reporter"
}
}
当我在我的计算机上本地运行测试时,我只需转到我的应用程序目录,打开控制台,编写 mocha --recursive --reporter min 并执行。然后,我所有的测试都运行得很完美,但是我必须先在我的计算机上全局安装 mocha。
如何在 Bamboo 中执行此操作?我尝试重新排列我的测试,以便它们不按文件夹组织,Bamboo 能够识别并运行它们,但我更喜欢将它们保存在单独的文件夹中。
顺便说一句,我遵循了 Atlassian 的教程 (https://confluence.atlassian.com/bamboocloud/getting-started-with-node-js-and-bamboo-737183843.html)
【问题讨论】: