From 8b051c13a27215a8c55586cf5d8f14aa6e5db0aa Mon Sep 17 00:00:00 2001 From: HenryNguyen5 Date: Thu, 5 Apr 2018 21:51:48 -0400 Subject: [PATCH] Add coverage reporting with coveralls (#1459) --- .travis.yml | 2 +- jest_config/jest.config.json | 3 ++- jest_config/jest.int.config.json | 3 ++- package.json | 35 ++++++++++++-------------------- 4 files changed, 18 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index d07dfadf..b322a69a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ jobs: - stage: test script: npm run prettier:diff - stage: test - script: npm run test + script: npm run test:coverage -- --maxWorkers=2 && npm run report-coverage - stage: test script: npm run tslint && npm run tscheck && npm run freezer && npm run freezer:validate diff --git a/jest_config/jest.config.json b/jest_config/jest.config.json index 74e8f17d..47f0627b 100644 --- a/jest_config/jest.config.json +++ b/jest_config/jest.config.json @@ -19,5 +19,6 @@ ], "automock": false, "snapshotSerializers": ["enzyme-to-json/serializer"], - "browser": true + "browser": true, + "collectCoverage": true } diff --git a/jest_config/jest.int.config.json b/jest_config/jest.int.config.json index 5973dd80..50c50180 100644 --- a/jest_config/jest.int.config.json +++ b/jest_config/jest.int.config.json @@ -18,5 +18,6 @@ ], "automock": false, "snapshotSerializers": ["enzyme-to-json/serializer"], - "browser": true + "browser": true, + "collectCoverage": true } diff --git a/package.json b/package.json index 11664588..ccde99d9 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,3 @@ - { "name": "MyCrypto", "author": "MyCryptoHQ", @@ -80,6 +79,7 @@ "check-node-version": "3.2.0", "concurrently": "3.5.1", "copy-webpack-plugin": "4.5.1", + "coveralls": "3.0.0", "css-loader": "0.28.11", "electron": "1.8.4", "electron-builder": "20.8.1", @@ -142,42 +142,33 @@ "prebuild": "check-node-version --package", "build:downloadable": "webpack --mode=production --config webpack_config/webpack.html.js", "prebuild:downloadable": "check-node-version --package", - "build:electron": - "webpack --config webpack_config/webpack.electron-prod.js && node webpack_config/buildElectron.js", - "build:electron:osx": - "webpack --config webpack_config/webpack.electron-prod.js && ELECTRON_OS=osx node webpack_config/buildElectron.js", - "build:electron:windows": - "webpack --config webpack_config/webpack.electron-prod.js && ELECTRON_OS=windows node webpack_config/buildElectron.js", - "build:electron:linux": - "webpack --config webpack_config/webpack.electron-prod.js && ELECTRON_OS=linux node webpack_config/buildElectron.js", + "build:electron": "webpack --config webpack_config/webpack.electron-prod.js && node webpack_config/buildElectron.js", + "build:electron:osx": "webpack --config webpack_config/webpack.electron-prod.js && ELECTRON_OS=osx node webpack_config/buildElectron.js", + "build:electron:windows": "webpack --config webpack_config/webpack.electron-prod.js && ELECTRON_OS=windows node webpack_config/buildElectron.js", + "build:electron:linux": "webpack --config webpack_config/webpack.electron-prod.js && ELECTRON_OS=linux node webpack_config/buildElectron.js", "prebuild:electron": "check-node-version --package", - "jenkins:build:linux": - "webpack --config webpack_config/webpack.electron-prod.js && ELECTRON_OS=JENKINS_LINUX node webpack_config/buildElectron.js", - "jenkins:build:mac": - "webpack --config webpack_config/webpack.electron-prod.js && ELECTRON_OS=JENKINS_MAC node webpack_config/buildElectron.js", + "jenkins:build:linux": "webpack --config webpack_config/webpack.electron-prod.js && ELECTRON_OS=JENKINS_LINUX node webpack_config/buildElectron.js", + "jenkins:build:mac": "webpack --config webpack_config/webpack.electron-prod.js && ELECTRON_OS=JENKINS_MAC node webpack_config/buildElectron.js", "jenkins:upload": "node jenkins/upload", "test:coverage": "jest --config=jest_config/jest.config.json --coverage", "test": "jest --config=jest_config/jest.config.json", "test:unit": "jest --config=jest_config/jest.config.json --coverage", "test:int": "jest --config=jest_config/jest.int.config.json --coverage", + "report-coverage": " cat ./coverage/lcov.info | coveralls", "updateSnapshot": "jest --config=jest_config/jest.config.json --updateSnapshot", "pretest": "check-node-version --package", "dev": "node webpack_config/devServer.js", "predev": "check-node-version --package", "dev:https": "HTTPS=true node webpack_config/devServer.js", "predev:https": "check-node-version --package", - "dev:electron": - "concurrently --kill-others --names 'webpack,electron' 'BUILD_ELECTRON=true node webpack_config/devServer.js' 'webpack --config webpack_config/webpack.electron-dev.js && electron dist/electron-js/main.js'", - "dev:electron:https": - "concurrently --kill-others --names 'webpack,electron' 'BUILD_ELECTRON=true HTTPS=true node webpack_config/devServer.js' 'HTTPS=true webpack --config webpack_config/webpack.electron-dev.js && electron dist/electron-js/main.js'", + "dev:electron": "concurrently --kill-others --names 'webpack,electron' 'BUILD_ELECTRON=true node webpack_config/devServer.js' 'webpack --config webpack_config/webpack.electron-dev.js && electron dist/electron-js/main.js'", + "dev:electron:https": "concurrently --kill-others --names 'webpack,electron' 'BUILD_ELECTRON=true HTTPS=true node webpack_config/devServer.js' 'HTTPS=true webpack --config webpack_config/webpack.electron-dev.js && electron dist/electron-js/main.js'", "tslint": "tslint --project . --exclude common/vendor/**/*", "tscheck": "tsc --noEmit", "start": "npm run dev", "precommit": "lint-staged", - "formatAll": - "find ./common/ -name '*.ts*' | xargs prettier --write --config ./.prettierrc --config-precedence file-override", - "prettier:diff": - "prettier --write --config ./.prettierrc --list-different \"common/**/*.ts\" \"common/**/*.tsx\"", + "formatAll": "find ./common/ -name '*.ts*' | xargs prettier --write --config ./.prettierrc --config-precedence file-override", + "prettier:diff": "prettier --write --config ./.prettierrc --list-different \"common/**/*.ts\" \"common/**/*.tsx\"", "prepush": "npm run tslint && npm run tscheck" }, "lint-staged": { @@ -193,4 +184,4 @@ "common/libs/decrypt.ts", "common/libs/signing.ts" ] -} \ No newline at end of file +}