Skip to content

Commit

Permalink
chore: monorepo root - bump to babel@7 and jest@23
Browse files Browse the repository at this point in the history
- bump to babel@7
- bump to jest@23
- move jest config from package.json to `jest.config.js`
- use custom babel-jest transform options to be sure babel works correctly with `.babelrc` in monorepo
  • Loading branch information
bodia-uz committed Sep 10, 2018
1 parent b2427dc commit 8cf868b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 17 deletions.
15 changes: 15 additions & 0 deletions config/jest/babelTransform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const babelJest = require('babel-jest');

module.exports = babelJest.createTransformer({
// NOTE: babel 7 uses different approach with .babelrc file loading
// so force it to look .babelrc on every monorepo package
// https://babeljs.io/docs/en/next/config-files#6x-vs-7x-babelrc-loading
// https://babeljs.io/docs/en/next/options#babelrcroots
babelrcRoots: [
// Keep the root as a root
'.',

// Also consider monorepo packages "root" and load their .babelrc files.
'./packages/*',
],
});
16 changes: 16 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
testEnvironment: 'node',
transform: {
'\\.js$': '<rootDir>/config/jest/babelTransform.js',
},
testPathIgnorePatterns: [
'/node_modules/',
'/packages/okidoc-md/lib/',
'/packages/okidoc-site/site/',
'/fixtures/',
],
collectCoverageFrom: [
'packages/okidoc-md/src/buildDocumentationSource/**/*.js',
'packages/okidoc-md/src/buildMarkdown/**/*.js',
],
};
21 changes: 4 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,17 @@
]
},
"devDependencies": {
"@babel/core": "7.0.0-beta.40",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "^22.4.3",
"@babel/core": "7.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.4.2",
"gh-pages": "^1.1.0",
"husky": "0.14.3",
"jest": "^22.4.0",
"jest": "^23.5.0",
"lerna": "^2.11.0",
"lint-staged": "^7.0.5",
"prettier": "^1.12.1",
"regenerator-runtime": "^0.11.1"
},
"jest": {
"testEnvironment": "node",
"testPathIgnorePatterns": [
"/node_modules/",
"/packages/okidoc-md/lib/",
"/packages/okidoc-site/site/",
"/fixtures/"
],
"collectCoverageFrom": [
"packages/okidoc-md/src/buildDocumentationSource/**/*.js",
"packages/okidoc-md/src/buildMarkdown/**/*.js"
]
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
}
Expand Down

0 comments on commit 8cf868b

Please sign in to comment.