Skip to content

Commit

Permalink
Added lerna-alias dep to automate creating jest aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist committed Dec 23, 2017
1 parent f402067 commit 7d4544f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 49 deletions.
11 changes: 11 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { jest: lernaAliases } = require('lerna-alias')

module.exports = {
transform: {
'\\.css$': '<rootDir>/test/styleTransform.js',
'^.+\\.js?$': 'babel-jest'
},
moduleNameMapper: lernaAliases(),
setupTestFrameworkScriptFile: '<rootDir>/test/testSetup.js',
coveragePathIgnorePatterns: ['<rootDir>/packages/emotion-utils/src/stylis.js']
}
8 changes: 8 additions & 0 deletions jest.dist.js
Original file line number Diff line number Diff line change
@@ -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']
})
26 changes: 0 additions & 26 deletions jest.dist.json

This file was deleted.

25 changes: 2 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -145,28 +146,6 @@
}
]
},
"jest": {
"transform": {
"\\.css$": "<rootDir>/test/styleTransform.js",
"^.+\\.js?$": "babel-jest"
},
"moduleNameMapper": {
"^emotion$": "<rootDir>/packages/emotion/src",
"^react-emotion$": "<rootDir>/packages/react-emotion/src",
"^emotion-utils$": "<rootDir>/packages/emotion-utils/src",
"^emotion-server$": "<rootDir>/packages/emotion-server/src",
"^emotion-theming$": "<rootDir>/packages/emotion-theming/src",
"^babel-plugin-emotion": "<rootDir>/packages/babel-plugin-emotion/src",
"^create-emotion$": "<rootDir>/packages/create-emotion/src",
"^jest-emotion$": "<rootDir>/packages/jest-emotion/src",
"^create-emotion-styled$": "<rootDir>/packages/create-emotion-styled/src",
"^create-emotion-server$": "<rootDir>/packages/create-emotion-server/src"
},
"setupTestFrameworkScriptFile": "<rootDir>/test/testSetup.js",
"coveragePathIgnorePatterns": [
"<rootDir>/packages/emotion-utils/src/stylis.js"
]
},
"workspaces": [
"packages/*"
],
Expand Down
6 changes: 6 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 7d4544f

Please sign in to comment.