diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 000000000..5e459c3d4 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,11 @@ +const { jest: lernaAliases } = require('lerna-alias') + +module.exports = { + transform: { + '\\.css$': '/test/styleTransform.js', + '^.+\\.js?$': 'babel-jest' + }, + moduleNameMapper: lernaAliases(), + setupTestFrameworkScriptFile: '/test/testSetup.js', + coveragePathIgnorePatterns: ['/packages/emotion-utils/src/stylis.js'] +} diff --git a/jest.dist.js b/jest.dist.js new file mode 100644 index 000000000..e5ac67c9f --- /dev/null +++ b/jest.dist.js @@ -0,0 +1,8 @@ +const { jest: lernaAliases } = require('lerna-alias') +const baseConfig = require('./jest.config.js') + +module.exports = Object.assign({}, baseConfig, { + moduleNameMapper: lernaAliases({ sourceDirectory: false }), + transformIgnorePatterns: ['dist', 'node_modules'], + testPathIgnorePatterns: ['babel-plugin-emotion'] +}) diff --git a/jest.dist.json b/jest.dist.json deleted file mode 100644 index 498830b70..000000000 --- a/jest.dist.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "transform": { - "\\.css$": "/test/styleTransform.js", - "^.+\\.js?$": "babel-jest" - }, - "moduleNameMapper": { - "^emotion$": "/packages/emotion/dist/index.cjs.js", - "^react-emotion$": "/packages/react-emotion/dist/index.cjs.js", - "^emotion-utils$": "/packages/emotion-utils/dist/index.cjs.js", - "^emotion-server$": "/packages/emotion-server/lib", - "^emotion-theming$": "/packages/emotion-theming/dist/index.cjs.js", - "^babel-plugin-emotion": "/packages/babel-plugin-emotion/lib", - "^create-emotion$": "/packages/create-emotion/dist/index.cjs.js", - "^jest-emotion$": "/packages/jest-emotion/lib", - "^create-emotion-styled$": "/packages/create-emotion-styled/dist/index.cjs.js", - "^create-emotion-server$": "/packages/create-emotion-server/lib" - }, - "transformIgnorePatterns": [ - "dist", - "node_modules" - ], - "testPathIgnorePatterns": [ - "babel-plugin-emotion" - ], - "setupTestFrameworkScriptFile": "/test/testSetup.js" -} \ No newline at end of file diff --git a/package.json b/package.json index 9a18cd151..7bd020e52 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "test": "npm-run-all -p lint:check coverage test:size test:typescript flow && npm run test:prod && npm run benchmark", "test:typescript": "lerna run test:typescript --parallel", "coverage": "jest --coverage --no-cache --ci --runInBand", - "test:prod": "npm run build && jest -c jest.dist.json --no-cache --ci --runInBand", + "test:prod": "npm run build && jest -c jest.dist.js --no-cache --ci --runInBand", "lint:check": "eslint .", "test:watch": "jest --watch --no-cache", "rollup": "lerna run rollup --parallel", @@ -71,6 +71,7 @@ "jest-serializer-html": "^4.0.1", "jsdom": "^11.3.0", "lerna": "^2.2.0", + "lerna-alias": "^3.0.0", "module-alias": "^2.0.1", "npm-run-all": "^4.0.2", "polished": "^1.2.1", @@ -145,28 +146,6 @@ } ] }, - "jest": { - "transform": { - "\\.css$": "/test/styleTransform.js", - "^.+\\.js?$": "babel-jest" - }, - "moduleNameMapper": { - "^emotion$": "/packages/emotion/src", - "^react-emotion$": "/packages/react-emotion/src", - "^emotion-utils$": "/packages/emotion-utils/src", - "^emotion-server$": "/packages/emotion-server/src", - "^emotion-theming$": "/packages/emotion-theming/src", - "^babel-plugin-emotion": "/packages/babel-plugin-emotion/src", - "^create-emotion$": "/packages/create-emotion/src", - "^jest-emotion$": "/packages/jest-emotion/src", - "^create-emotion-styled$": "/packages/create-emotion-styled/src", - "^create-emotion-server$": "/packages/create-emotion-server/src" - }, - "setupTestFrameworkScriptFile": "/test/testSetup.js", - "coveragePathIgnorePatterns": [ - "/packages/emotion-utils/src/stylis.js" - ] - }, "workspaces": [ "packages/*" ], diff --git a/yarn.lock b/yarn.lock index 934da2cc1..fc261435b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6163,6 +6163,12 @@ lcid@^1.0.0: dependencies: invert-kv "^1.0.0" +lerna-alias@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lerna-alias/-/lerna-alias-3.0.0.tgz#3e1cce3e83463fcfa42c5486d19d8edfe4035afb" + dependencies: + glob "^7.1.2" + lerna@^2.2.0: version "2.4.0" resolved "https://registry.yarnpkg.com/lerna/-/lerna-2.4.0.tgz#7b76446b154bafb9cba8996f3dc233f1cb6ca7c3"