From 2764f2eda83ed4a910d553d67a2fc24a5f79caee Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 7 Oct 2019 17:35:26 +0200 Subject: [PATCH] move jest config --- .travis.yml | 3 ++- package.json | 21 +++++++++++++++++++-- src/renderer/jest.config.js | 13 ------------- 3 files changed, 21 insertions(+), 16 deletions(-) delete mode 100644 src/renderer/jest.config.js diff --git a/.travis.yml b/.travis.yml index b57edb2..3095778 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,8 @@ before_script: script: - npm test || travis_terminate 1 - - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT + - ./cc-test-reporter format-coverage -t lcov -o coverage/codeclimate.json src/renderer/coverage/lcov.info + - if [[ "$TRAVIS_TEST_RESULT" == 0 ]]; then ./cc-test-reporter upload-coverage; fi - npm run dist branches: diff --git a/package.json b/package.json index 1569a57..fc1dc43 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,8 @@ "description": "🐡 Simple Electron-based desktop app to retrieve and display your total Ocean Token balances.", "main": "./src/main/index.js", "scripts": { - "test": "npm run lint && jest --config=src/renderer/jest.config.js --coverage", - "test:watch": "jest --config=src/renderer/jest.config.js --coverage --watch", + "test": "npm run lint && jest --coverage", + "test:watch": "jest --coverage --watch", "lint": "eslint --ignore-path .gitignore ./src/**/*.{js,jsx} && stylelint --ignore-path .gitignore ./src/**/*.{css,scss}", "start": "webpack-dev-server --hot --host 0.0.0.0 --config=./webpack.dev.config.js", "build": "cross-env NODE_ENV=production webpack --config webpack.common.config.js", @@ -124,5 +124,22 @@ "npm": { "publish": false } + }, + "jest": { + "rootDir": "src/renderer", + "transform": { + "^.+\\.jsx?$": "babel-jest" + }, + "moduleNameMapper": { + ".+\\.(css|styl|less|sass|scss)$": "identity-obj-proxy", + ".+\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/jest/__mocks__/file-mock.js", + "\\.svg": "/jest/__mocks__/svgr-mock.js" + }, + "testURL": "http://localhost", + "setupFilesAfterEnv": [ + "/jest/setup-test-env.js" + ], + "runner": "@jest-runner/electron", + "testEnvironment": "@jest-runner/electron/environment" } } diff --git a/src/renderer/jest.config.js b/src/renderer/jest.config.js deleted file mode 100644 index c5aa35d..0000000 --- a/src/renderer/jest.config.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = { - moduleNameMapper: { - '.+\\.(css|styl|less|sass|scss)$': 'identity-obj-proxy', - '.+\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': - '/jest/__mocks__/file-mock.js', - '\\.svg': '/jest/__mocks__/svgr-mock.js' - }, - testPathIgnorePatterns: ['node_modules', 'dist', 'build', 'coverage'], - testURL: 'http://localhost', - setupFilesAfterEnv: ['/jest/setup-test-env.js'], - runner: '@jest-runner/electron', - testEnvironment: '@jest-runner/electron/environment' -}