mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
Mocha 3 and Coverage (#8601)
* upgrade mocha to v3 * shrinkwrap * import changes from PR #8487 * fix bin * upgrade istanbul * use correct mocha bin
This commit is contained in:
16
.travis.yml
16
.travis.yml
@@ -16,18 +16,18 @@ before_script:
|
|||||||
- npm run test:build
|
- npm run test:build
|
||||||
- cp config.json.example config.json
|
- cp config.json.example config.json
|
||||||
- if [ $REQUIRES_SERVER ]; then until nc -z localhost 27017; do echo Waiting for MongoDB; sleep 1; done; export DISPLAY=:99; fi
|
- if [ $REQUIRES_SERVER ]; then until nc -z localhost 27017; do echo Waiting for MongoDB; sleep 1; done; export DISPLAY=:99; fi
|
||||||
after_script:
|
script:
|
||||||
- ./node_modules/.bin/lcov-result-merger 'coverage/**/*.info' | ./node_modules/coveralls/bin/coveralls.js
|
- npm run $TEST
|
||||||
script: npm run $TEST
|
- if [ $COVERAGE ]; then ./node_modules/.bin/lcov-result-merger 'coverage/**/*.info' | ./node_modules/coveralls/bin/coveralls.js; fi
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- CXX=g++-4.8
|
- CXX=g++-4.8
|
||||||
- DISABLE_REQUEST_LOGGING=true
|
- DISABLE_REQUEST_LOGGING=true
|
||||||
matrix:
|
matrix:
|
||||||
- TEST="lint"
|
- TEST="lint"
|
||||||
- TEST="test:api-v3" REQUIRES_SERVER=true
|
- TEST="test:api-v3" REQUIRES_SERVER=true COVERAGE=true
|
||||||
- TEST="test:sanity"
|
- TEST="test:sanity"
|
||||||
- TEST="test:content"
|
- TEST="test:content" COVERAGE=true
|
||||||
- TEST="test:common"
|
- TEST="test:common" COVERAGE=true
|
||||||
- TEST="test:karma"
|
- TEST="test:karma" COVERAGE=true
|
||||||
- TEST="client:unit"
|
- TEST="client:unit" COVERAGE=true
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ gulp.task('test:e2e:safe', ['test:prepare', 'test:prepare:server'], (cb) => {
|
|||||||
|
|
||||||
gulp.task('test:api-v3:unit', (done) => {
|
gulp.task('test:api-v3:unit', (done) => {
|
||||||
let runner = exec(
|
let runner = exec(
|
||||||
testBin('mocha test/api/v3/unit --recursive --require ./test/helpers/start-server'),
|
testBin('node_modules/.bin/istanbul cover --dir coverage/api-v3-unit --report lcovonly node_modules/mocha/bin/_mocha -- test/api/v3/unit --recursive --require ./test/helpers/start-server'),
|
||||||
(err, stdout, stderr) => {
|
(err, stdout, stderr) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
@@ -298,7 +298,7 @@ gulp.task('test:api-v3:unit:watch', () => {
|
|||||||
|
|
||||||
gulp.task('test:api-v3:integration', (done) => {
|
gulp.task('test:api-v3:integration', (done) => {
|
||||||
let runner = exec(
|
let runner = exec(
|
||||||
testBin('mocha test/api/v3/integration --recursive --require ./test/helpers/start-server'),
|
testBin('node_modules/.bin/istanbul cover --dir coverage/api-v3-integration --report lcovonly node_modules/mocha/bin/_mocha -- test/api/v3/integration --recursive --require ./test/helpers/start-server'),
|
||||||
{maxBuffer: 500 * 1024},
|
{maxBuffer: 500 * 1024},
|
||||||
(err, stdout, stderr) => {
|
(err, stdout, stderr) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
1884
npm-shrinkwrap.json
generated
1884
npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@@ -139,9 +139,9 @@
|
|||||||
"test:api-v3:unit": "gulp test:api-v3:unit",
|
"test:api-v3:unit": "gulp test:api-v3:unit",
|
||||||
"test:api-v3:integration": "gulp test:api-v3:integration",
|
"test:api-v3:integration": "gulp test:api-v3:integration",
|
||||||
"test:api-v3:integration:separate-server": "NODE_ENV=test gulp test:api-v3:integration:separate-server",
|
"test:api-v3:integration:separate-server": "NODE_ENV=test gulp test:api-v3:integration:separate-server",
|
||||||
"test:sanity": "mocha test/sanity --recursive",
|
"test:sanity": "istanbul cover --dir coverage/sanity --report lcovonly node_modules/mocha/bin/_mocha -- test/sanity --recursive",
|
||||||
"test:common": "mocha test/common --recursive",
|
"test:common": "istanbul cover --dir coverage/common --report lcovonly node_modules/mocha/bin/_mocha -- test/common --recursive",
|
||||||
"test:content": "mocha test/content --recursive",
|
"test:content": "istanbul cover --dir coverage/content --report lcovonly node_modules/mocha/bin/_mocha -- test/content --recursive",
|
||||||
"test:karma": "karma start test/client-old/spec/karma.conf.js --single-run",
|
"test:karma": "karma start test/client-old/spec/karma.conf.js --single-run",
|
||||||
"test:karma:watch": "karma start test/client-old/spec/karma.conf.js",
|
"test:karma:watch": "karma start test/client-old/spec/karma.conf.js",
|
||||||
"test:prepare:webdriver": "webdriver-manager update",
|
"test:prepare:webdriver": "webdriver-manager update",
|
||||||
@@ -183,7 +183,7 @@
|
|||||||
"grunt-karma": "~0.12.1",
|
"grunt-karma": "~0.12.1",
|
||||||
"http-proxy-middleware": "^0.17.0",
|
"http-proxy-middleware": "^0.17.0",
|
||||||
"inject-loader": "^3.0.0-beta4",
|
"inject-loader": "^3.0.0-beta4",
|
||||||
"istanbul": "^0.3.14",
|
"istanbul": "^1.1.0-alpha.1",
|
||||||
"karma": "^1.3.0",
|
"karma": "^1.3.0",
|
||||||
"karma-babel-preprocessor": "^6.0.1",
|
"karma-babel-preprocessor": "^6.0.1",
|
||||||
"karma-chai-plugins": "~0.6.0",
|
"karma-chai-plugins": "~0.6.0",
|
||||||
@@ -198,7 +198,7 @@
|
|||||||
"karma-webpack": "^2.0.2",
|
"karma-webpack": "^2.0.2",
|
||||||
"lcov-result-merger": "^1.0.2",
|
"lcov-result-merger": "^1.0.2",
|
||||||
"lolex": "^1.4.0",
|
"lolex": "^1.4.0",
|
||||||
"mocha": "^2.3.3",
|
"mocha": "^3.2.0",
|
||||||
"mongodb": "^2.0.46",
|
"mongodb": "^2.0.46",
|
||||||
"mongoskin": "~2.1.0",
|
"mongoskin": "~2.1.0",
|
||||||
"monk": "^4.0.0",
|
"monk": "^4.0.0",
|
||||||
|
|||||||
@@ -81,8 +81,11 @@ module.exports = function karmaConfig (config) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
coverageReporter: {
|
coverageReporter: {
|
||||||
type: 'lcov',
|
reporters: [
|
||||||
dir: 'coverage/karma',
|
{ type: 'lcov', subdir: '.' },
|
||||||
|
{ type: 'text-summary' },
|
||||||
|
],
|
||||||
|
dir: '../../../coverage/karma',
|
||||||
},
|
},
|
||||||
|
|
||||||
// Enable mocha-style reporting, for better test visibility
|
// Enable mocha-style reporting, for better test visibility
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ module.exports = function (config) {
|
|||||||
noInfo: true,
|
noInfo: true,
|
||||||
},
|
},
|
||||||
coverageReporter: {
|
coverageReporter: {
|
||||||
dir: './coverage',
|
dir: '../../../coverage/client-unit',
|
||||||
reporters: [
|
reporters: [
|
||||||
{ type: 'lcov', subdir: '.' },
|
{ type: 'lcov', subdir: '.' },
|
||||||
{ type: 'text-summary' },
|
{ type: 'text-summary' },
|
||||||
|
|||||||
Reference in New Issue
Block a user