diff --git a/.travis.yml b/.travis.yml index 2e85f31ee0..2f4ab35dcf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,23 @@ -branches: - only: - - master +# branches: +# only: +# - master language: node_js node_js: - "4.3" env: - global: + global: - COVERAGE_OPTION='./node_modules/babel-istanbul/lib/cli.js cover -x **/spec/**' + - CXX=g++-4.8 matrix: - MONGODB_VERSION=2.6.11 - MONGODB_VERSION=3.0.8 +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.8 cache: directories: - - $HOME/.mongodb/versions/downloads + - node_modules/ after_success: ./node_modules/.bin/codecov diff --git a/package.json b/package.json index b6a5dff0fb..8c1282100e 100644 --- a/package.json +++ b/package.json @@ -63,10 +63,8 @@ "scripts": { "dev": "npm run build && node bin/dev", "build": "./node_modules/.bin/babel src/ -d lib/", - "pretest": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.0.8} ./node_modules/.bin/mongodb-runner start", "test": "cross-env NODE_ENV=test TESTING=1 ./node_modules/.bin/babel-node $COVERAGE_OPTION ./node_modules/jasmine/bin/jasmine.js", "test:win": "npm run pretest && cross-env NODE_ENV=test TESTING=1 ./node_modules/.bin/babel-node ./node_modules/babel-istanbul/lib/cli.js cover -x **/spec/** ./node_modules/jasmine/bin/jasmine.js && npm run posttest", - "posttest": "./node_modules/.bin/mongodb-runner stop", "coverage": "cross-env COVERAGE_OPTION='./node_modules/babel-istanbul/lib/cli.js cover -x **/spec/**' npm test", "start": "node ./bin/parse-server", "prepublish": "npm run build" diff --git a/spec/helper.js b/spec/helper.js index e8cabbb4ea..5960a9446a 100644 --- a/spec/helper.js +++ b/spec/helper.js @@ -78,6 +78,20 @@ Parse.serverURL = 'http://localhost:' + port + '/1'; // TODO: update tests to work in an A+ way Parse.Promise.disableAPlusCompliant(); +process.env.DEBUG = 'mon*'; + +// Travis will set this environment variable so we always test against +// MongoDB 2.6.11 and 3.0.8. Set the default here so when devs just +// run `npm test` locally MongoDB@3.0.8 will be installed if needed and +// used. +if (!process.env.MONGODB_VERSION) { + process.env.MONGODB_VERSION = '3.0.8'; +} + +// Start MongoDB before running the test suite and stop it afterwards. +beforeAll(require('mongodb-runner/mocha/before')); +afterAll(require('mongodb-runner/mocha/after')); + beforeEach(function(done) { restoreServerConfiguration(); Parse.initialize('test', 'test', 'test');