Skip to content

Commit

Permalink
Upgrade Babel to 7.6.2 and Jest to 24.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vkrol authored and blainekasten committed Oct 14, 2019
1 parent 5556aa6 commit 271af50
Show file tree
Hide file tree
Showing 10 changed files with 2,247 additions and 1,307 deletions.
3 changes: 3 additions & 0 deletions babel-jest-root-mode-wrapper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = require('babel-jest').createTransformer({
rootMode: 'upward',
});
14 changes: 12 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
const presets = [ 'env', 'react' ];
const presets = [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
'@babel/preset-react',
'@babel/preset-flow',
];

const plugins = [
'transform-object-rest-spread',
'add-module-exports',
];

Expand Down
25 changes: 9 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,14 @@
"enzyme"
],
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-eslint": "^8.2.1",
"babel-jest": "^10.0.1",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-plugin-transform-replace-object-assign": "^0.2.1",
"babel-preset-airbnb": "^2.4.0",
"babel-preset-env": "^1.5.2",
"babel-preset-flow": "^6.23.0",
"babel-preset-react": "^6.24.1",
"@babel/cli": "^7.6.2",
"babel-eslint": "^10.0.3",
"babel-jest": "^24.9.0",
"babel-plugin-add-module-exports": "^1.0.2",
"babel-preset-airbnb": "^4.1.0",
"@babel/preset-env": "^7.6.2",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"enzyme": "^3.4.0",
"enzyme-adapter-react-16": "^1.5.0",
"eslint": "^4.9.0",
Expand All @@ -63,7 +61,7 @@
"flow-bin": "^0.105.2",
"flow-copy-source": "^1.2.0",
"husky": "^0.14.3",
"jest": "^22.4.4",
"jest": "^24.9.0",
"lerna": "^3.4.0",
"lint-staged": "^4.0.2",
"prettier": "^1.5.3",
Expand All @@ -74,11 +72,6 @@
"readline-sync": "^1.4.1",
"rimraf": "^2.5.0"
},
"babel": {
"presets": [
"./babel.config.js"
]
},
"jest": {
"testEnvironment": "<rootDir>/packages/jest-environment-enzyme/lib/index.js",
"testEnvironmentOptions": {
Expand Down
5 changes: 4 additions & 1 deletion packages/enzyme-matchers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"jest": "node ../../node_modules/jest-cli/bin/jest.js",
"lint": "eslint ./src",
"clean": "rm -rf ./lib",
"build:js": "babel src --out-dir lib --ignore tests",
"build:js": "babel --root-mode upward src --out-dir lib --ignore '**/__tests__/*.js'",
"build:flow": "flow-copy-source -v -i '**/__tests__/*.js' src lib",
"build": "npm run clean && npm run build:js && npm run build:flow",
"prepublish": "npm run build"
Expand All @@ -39,6 +39,9 @@
"flow-bin": "^0.105.2"
},
"jest": {
"transform": {
"^.+\\.js$": "../../babel-jest-root-mode-wrapper.js"
},
"roots": [
"<rootDir>/src"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,14 @@ Object {
"actual": "HTML Output of <2 (anonymous) nodes found>:
Multiple nodes found:
0: <function User(props) {
return (
/* istanbul ignore next */React.createElement( /* istanbul ignore next */'span', /* istanbul ignore next */{ className: props.className }, /* istanbul ignore next */'User ',
props.index));
return React.createElement(\\"span\\", {
className: props.className
}, \\"User \\", props.index);
} index=\\"1\\" className=\\"userOne\\"/>
1: <function User(props) {
return (
/* istanbul ignore next */React.createElement( /* istanbul ignore next */'span', /* istanbul ignore next */{ className: props.className }, /* istanbul ignore next */'User ',
props.index));
return React.createElement(\\"span\\", {
className: props.className
}, \\"User \\", props.index);
} index=\\"2\\" className=\\"userTwo\\"/>
",
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function Fixture() {
return (
<div>
<input defaultValue="test" />
<input defaultValue="foo" value="bar" onChange={jest.genMockFunction()} />
<input defaultValue="foo" value="bar" onChange={jest.fn()} />
</div>
);
}
Expand Down
5 changes: 4 additions & 1 deletion packages/jasmine-enzyme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"jasmine": "../../node_modules/jasmine/bin/jasmine.js",
"lint": "eslint ./src",
"clean": "rm -rf ./lib",
"build:js": "babel src --out-dir lib --ignore tests",
"build:js": "babel --root-mode upward src --out-dir lib --ignore '**/__tests__/*.js'",
"build:flow": "flow-copy-source -v -i '**/__tests__/*.js' src lib",
"build": "npm run clean && npm run build:js && npm run build:flow",
"prepublish": "npm run build"
Expand Down Expand Up @@ -50,6 +50,9 @@
"enzyme-matchers": "^7.1.1"
},
"jest": {
"transform": {
"^.+\\.js$": "../../babel-jest-root-mode-wrapper.js"
},
"setupTestFrameworkScriptFile": "jest-enzyme/src/index.js",
"testEnvironment": "enzyme",
"roots": [
Expand Down
24 changes: 6 additions & 18 deletions packages/jest-environment-enzyme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
"scripts": {
"lint": "eslint ./src",
"clean": "rm -rf ./lib",
"build:js": "babel src --out-dir lib --ignore tests --copy-files",
"build": "npm run clean && npm run build:js",
"build:js": "babel --root-mode upward src --out-dir lib --ignore '**/__tests__/*.js'",
"copy-dts": "cpy src/index.d.ts lib",
"build": "npm run clean && npm run build:js && npm run copy-dts",
"prepublish": "npm run build"
},
"files": [
Expand Down Expand Up @@ -44,23 +45,10 @@
"jest": ">=22.0.0",
"react": "^0.13.0 || ^0.14.0 || ^15.0.0 || >=16.x"
},
"devDependencies": {
"cpy-cli": "^2.0.0"
},
"dependencies": {
"jest-environment-jsdom": "^24.0.0"
},
"babel": {
"presets": [
[
"env",
{
"targets": {
"node": "current"
}
}
],
"flow"
],
"plugins": [
"add-module-exports"
]
}
}
11 changes: 8 additions & 3 deletions packages/jest-enzyme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
"jest": "node ../../node_modules/jest-cli/bin/jest.js __tests__",
"lint": "eslint ./src",
"clean": "rm -rf ./lib",
"build:js": "babel src --out-dir lib --ignore tests --copy-files",
"build:js": "babel --root-mode upward src --out-dir lib --ignore '**/__tests__/*.js' --ignore '**/__failing_tests__/*.js'",
"build:flow": "flow-copy-source -v -i '**/__tests__/*.js' -i '**/__failing_tests__/*.js' src lib",
"build": "npm run clean && npm run build:js && npm run build:flow",
"copy-dts": "cpy src/index.d.ts lib",
"build": "npm run clean && npm run build:js && npm run build:flow && npm run copy-dts",
"prepublish": "npm run build"
},
"files": [
Expand Down Expand Up @@ -55,9 +56,13 @@
},
"devDependencies": {
"@types/enzyme": "^3.1.11",
"@types/react": "^16.0.10"
"@types/react": "^16.0.10",
"cpy-cli": "^2.0.0"
},
"jest": {
"transform": {
"^.+\\.js$": "../../babel-jest-root-mode-wrapper.js"
},
"roots": [
"<rootDir>/src"
],
Expand Down
Loading

0 comments on commit 271af50

Please sign in to comment.