Travis CI で Express フレームワークと MongoDb を使用して作成した残りの API サービスをテストしたいと考えています。テストは私のマシンではローカルで動作しますが、Travis CI では失敗します。問題は私の .travis.yml と package.json にあると思います。
テストをローカルで実行する方法は次のとおりです。
// opens mongodb database on port 27017
mongod
// reads the db and returns documents depending on the request
node express.js
// test CRUD operations on the app
mocha express.test.js
travis CI で同じことを行うにはどうすればよいですか? これが私のアプリhttps://github.com/mujuni88/Express-RestApi-Tutorialです。
travis.yml:
language: node_js
node_js:
- "0.10"
- "0.9"
services: mongodb
script:
- "./node_modules/mocha/bin/mocha *.test.js"
パッケージ.json:
{
"name":"express-restapi",
"author":"Joe Buza",
"description":"Express RestApi",
"version": "0.0.1",
"private": true,
"keywords":["angular", "mocha", "mongodb", "express"],
"license":"BSD",
"dependencies": {
"express":"3.4.4",
"mongoskin":"0.6.0"
},
"devDependencies":{
"mocha":"1.13.0",
"expect.js":"0.2.0",
"superagent":"0.15.7"
},
"scripts":{
"start":"node express.js"
}
}