From bb4a7ac8464441343ccd9594f1a0d6ffac612b49 Mon Sep 17 00:00:00 2001 From: Aaron Mc Adam Date: Thu, 18 May 2017 17:57:07 +0100 Subject: [PATCH] chore(jest): update to v20's default configuration file * we no longer have to pass a `--config` flag to Jest * renames .jestrc json to jest.config.js * jest-enzyme now includes snapshot support by default --- .jestrc.json | 23 ----------------------- jest.config.js | 14 ++++++++++++++ package.json | 13 ++++++------- 3 files changed, 20 insertions(+), 30 deletions(-) delete mode 100644 .jestrc.json create mode 100644 jest.config.js diff --git a/.jestrc.json b/.jestrc.json deleted file mode 100644 index 9d5dd48c424e..000000000000 --- a/.jestrc.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "cacheDirectory": ".cache/jest", - "clearMocks": true, - "moduleNameMapper": { - "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/__mocks__/fileMock.js", - "\\.(css|scss)$": "/__mocks__/styleMock.js" - }, - "projects": [ - "/packages/*", - "/examples/*" - ], - "collectCoverage": false, - "collectCoverageFrom": [ - "packages/**/*.{js,jsx}", - "!**/generators/**" - ], - "coverageDirectory": "coverage", - "testEnvironment": "jsdom", - "setupTestFrameworkScriptFile": "./node_modules/jest-enzyme/lib/index.js", - "snapshotSerializers": [ - "enzyme-to-json/serializer" - ] -} diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 000000000000..9c2938d5b1d6 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,14 @@ +module.exports = { + cacheDirectory: '.cache/jest', + clearMocks: true, + moduleNameMapper: { + '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '/__mocks__/fileMock.js', + '\\.(css|scss)$': '/__mocks__/styleMock.js', + }, + projects: ['/packages/*', '/examples/*'], + collectCoverage: false, + collectCoverageFrom: ['packages/**/*.{js,jsx}', '!**/generators/**'], + coverageDirectory: 'coverage', + testEnvironment: 'jsdom', + setupTestFrameworkScriptFile: './node_modules/jest-enzyme/lib/index.js', +}; diff --git a/package.json b/package.json index 277d7bea8bf3..dd7b3a65e6e8 100644 --- a/package.json +++ b/package.json @@ -11,26 +11,25 @@ "babel-preset-stage-0": "^6.24.1", "codecov": "^2.1.0", "enzyme": "^2.8.2", - "enzyme-to-json": "^1.5.1", "eslint": "^3.19.0", "eslint-config-airbnb-base": "^11.1.3", "eslint-plugin-import": "^2.2.0", - "eslint-plugin-jest": "^20.0.0", + "eslint-plugin-jest": "^20.0.3", "eslint-plugin-prettier": "^2.0.1", - "jest": "^20.0.0", - "jest-enzyme": "^3.1.0", + "jest": "^20.0.3", + "jest-enzyme": "^3.1.1", "lerna": "2.0.0-rc.4", "prettier": "^1.3.0", "react": "^15.5.4", - "react-addons-test-utils": "^15.5.1", + "react-test-renderer": "^15.5.4", "react-dom": "^15.5.4", "shelljs": "^0.7.7" }, "scripts": { "bootstrap": "lerna bootstrap", "lint": "eslint .", - "test": "jest --config ./.jestrc.json", + "test": "jest", "test:watch": "npm test -- --watch", "coverage": "codecov" } -} +} \ No newline at end of file