Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update react peerDepedencies and enzyme adapter #62

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"presets": ["env", "react"],
"plugins": ["transform-object-rest-spread"]
"presets": ["@babel/env", "@babel/react"],
"plugins": ["@babel/plugin-proposal-object-rest-spread"]
}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
language: node_js
node_js:
- "10"
- "14"
- "16"
before_install:
- npm install -g npm-install-peers
- npm-install-peers
script:
- npm test
- npm run build
Expand Down
15 changes: 0 additions & 15 deletions __tests__/__snapshots__/checkbox-svg-map.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,8 @@ exports[`CheckboxSVGMap component Rendering displays map with default props 1`]
d="path0"
id="id0"
name="name0"
onBlur={undefined}
onClick={[Function]}
onFocus={undefined}
onKeyDown={[Function]}
onMouseMove={undefined}
onMouseOut={undefined}
onMouseOver={undefined}
role="checkbox"
tabIndex="0"
/>
Expand All @@ -100,13 +95,8 @@ exports[`CheckboxSVGMap component Rendering displays map with default props 1`]
d="path1"
id="id1"
name="name1"
onBlur={undefined}
onClick={[Function]}
onFocus={undefined}
onKeyDown={[Function]}
onMouseMove={undefined}
onMouseOut={undefined}
onMouseOver={undefined}
role="checkbox"
tabIndex="0"
/>
Expand All @@ -117,13 +107,8 @@ exports[`CheckboxSVGMap component Rendering displays map with default props 1`]
d="path2"
id="id2"
name="name2"
onBlur={undefined}
onClick={[Function]}
onFocus={undefined}
onKeyDown={[Function]}
onMouseMove={undefined}
onMouseOut={undefined}
onMouseOver={undefined}
role="checkbox"
tabIndex="0"
/>
Expand Down
15 changes: 0 additions & 15 deletions __tests__/__snapshots__/radio-svg-map.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,8 @@ exports[`RadioSVGMap component Rendering displays map with default props 1`] = `
d="path0"
id="id0"
name="name0"
onBlur={undefined}
onClick={[Function]}
onFocus={undefined}
onKeyDown={[Function]}
onMouseMove={undefined}
onMouseOut={undefined}
onMouseOver={undefined}
role="radio"
tabIndex="0"
/>
Expand All @@ -100,13 +95,8 @@ exports[`RadioSVGMap component Rendering displays map with default props 1`] = `
d="path1"
id="id1"
name="name1"
onBlur={undefined}
onClick={[Function]}
onFocus={undefined}
onKeyDown={[Function]}
onMouseMove={undefined}
onMouseOut={undefined}
onMouseOver={undefined}
role="radio"
tabIndex="-1"
/>
Expand All @@ -117,13 +107,8 @@ exports[`RadioSVGMap component Rendering displays map with default props 1`] = `
d="path2"
id="id2"
name="name2"
onBlur={undefined}
onClick={[Function]}
onFocus={undefined}
onKeyDown={[Function]}
onMouseMove={undefined}
onMouseOut={undefined}
onMouseOver={undefined}
role="radio"
tabIndex="-1"
/>
Expand Down
48 changes: 0 additions & 48 deletions __tests__/__snapshots__/svg-map.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,29 @@ exports[`SVGMap component Properties displays map with custom function location
xmlns="http://www.w3.org/2000/svg"
>
<path
aria-checked={undefined}
aria-label="name0-0"
className="locationClassName-0"
d="path0"
id="id0"
name="name0"
onBlur={undefined}
onClick={undefined}
onFocus={undefined}
onKeyDown={undefined}
onMouseMove={undefined}
onMouseOut={undefined}
onMouseOver={undefined}
role="none"
tabIndex="locationTabIndex-0"
/>
<path
aria-checked={undefined}
aria-label="name1-1"
className="locationClassName-1"
d="path1"
id="id1"
name="name1"
onBlur={undefined}
onClick={undefined}
onFocus={undefined}
onKeyDown={undefined}
onMouseMove={undefined}
onMouseOut={undefined}
onMouseOver={undefined}
role="none"
tabIndex="locationTabIndex-1"
/>
<path
aria-checked={undefined}
aria-label="name2-2"
className="locationClassName-2"
d="path2"
id="id2"
name="name2"
onBlur={undefined}
onClick={undefined}
onFocus={undefined}
onKeyDown={undefined}
onMouseMove={undefined}
onMouseOut={undefined}
onMouseOver={undefined}
role="none"
tabIndex="locationTabIndex-2"
/>
Expand Down Expand Up @@ -139,53 +115,29 @@ exports[`SVGMap component Properties displays map with default props 1`] = `
xmlns="http://www.w3.org/2000/svg"
>
<path
aria-checked={undefined}
aria-label="name0"
className="svg-map__location"
d="path0"
id="id0"
name="name0"
onBlur={undefined}
onClick={undefined}
onFocus={undefined}
onKeyDown={undefined}
onMouseMove={undefined}
onMouseOut={undefined}
onMouseOver={undefined}
role="none"
tabIndex="0"
/>
<path
aria-checked={undefined}
aria-label="name1"
className="svg-map__location"
d="path1"
id="id1"
name="name1"
onBlur={undefined}
onClick={undefined}
onFocus={undefined}
onKeyDown={undefined}
onMouseMove={undefined}
onMouseOut={undefined}
onMouseOver={undefined}
role="none"
tabIndex="0"
/>
<path
aria-checked={undefined}
aria-label="name2"
className="svg-map__location"
d="path2"
id="id2"
name="name2"
onBlur={undefined}
onClick={undefined}
onFocus={undefined}
onKeyDown={undefined}
onMouseMove={undefined}
onMouseOut={undefined}
onMouseOver={undefined}
role="none"
tabIndex="0"
/>
Expand Down
3 changes: 2 additions & 1 deletion jest-setup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

import Adapter from '@wojtekmaj/enzyme-adapter-react-17';

configure({ adapter: new Adapter() });
7 changes: 5 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
module.exports = {
// Fix "localStorage is not available for opaque origins" error
// https://github.com/jsdom/jsdom/issues/2304
testURL: 'http://localhost',
testEnvironmentOptions: {
url: 'http://localhost',
},
testEnvironment: 'jsdom',

// Mock imported scss file
// https://jestjs.io/docs/en/webpack.html#handling-static-assets
moduleNameMapper: {
'\\.scss$': '<rootDir>/__tests__/__mocks__/styleMock.js'
},

setupTestFrameworkScriptFile: '<rootDir>/jest-setup.js',
setupFilesAfterEnv: ['<rootDir>/jest-setup.js'],
testMatch: ['**/__tests__/**/*.test.js'],
collectCoverage: true,
coverageDirectory: './coverage/',
Expand Down
65 changes: 32 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"scripts": {
"start": "webpack-dev-server --mode development --open --config webpack.examples.config.js",
"build": "webpack --mode production",
"lint": "eslint src/*.js* src/maps/*.js",
"lint": "eslint ./src/*.js*",
"test": "jest",
"test:update": "jest --updateSnapshot",
"build-demo": "webpack --mode production --config webpack.examples.config.js && cp examples/dist/* docs",
"build-tests": "jest -u",
"prepare": "npm run lint && npm test && npm run build"
Expand Down Expand Up @@ -36,43 +37,41 @@
"/lib"
],
"devDependencies": {
"@svg-maps/australia": "^1.1.0",
"@svg-maps/france.regions": "^1.1.0",
"@babel/core": "^7.20.2",
"@babel/plugin-proposal-object-rest-spread": "^7.20.2",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@svg-maps/australia": "^1.1.1",
"@svg-maps/france.regions": "^1.1.1",
"@svg-maps/taiwan.main": "^1.0.0",
"@svg-maps/usa": "^1.1.0",
"@svg-maps/usa.utah": "^1.1.0",
"babel-core": "^6.26.3",
"babel-jest": "^22.4.4",
"babel-loader": "^7.1.5",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"css-loader": "^0.28.11",
"@svg-maps/usa": "^1.1.1",
"@svg-maps/usa.utah": "^1.1.1",
"@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
"babel-jest": "^29.3.1",
"babel-loader": "^9.1.0",
"css-loader": "^6.7.2",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"eslint": "^4.19.1",
"eslint-loader": "^2.2.1",
"eslint-plugin-jest": "^21.27.2",
"eslint-plugin-react": "^7.17.0",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"jest": "^22.4.4",
"mini-css-extract-plugin": "^0.2.0",
"node-sass": "^4.13.0",
"react": "16.1.0",
"react-dom": "16.1.0",
"react-test-renderer": "16.1.0",
"sass-loader": "^6.0.7",
"style-loader": "^0.20.3",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.10.1"
"eslint": "^8.28.0",
"eslint-plugin-jest": "^27.1.5",
"eslint-plugin-react": "^7.31.11",
"html-loader": "^4.2.0",
"html-webpack-plugin": "^5.5.0",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"mini-css-extract-plugin": "^2.7.0",
"react-test-renderer": "^17.0.2",
"sass": "^1.56.1",
"sass-loader": "^13.2.0",
"style-loader": "^3.3.1",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.0",
"webpack-dev-server": "^4.11.1"
},
"dependencies": {
"prop-types": "^15.7.2"
"prop-types": "^15.8.1"
},
"peerDependencies": {
"react": "^16.0.0",
"react-dom": "^16.0.0"
"react": "^16 || ^17",
"react-dom": "^16 || ^17"
}
}
5 changes: 1 addition & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ module.exports = {
test: /\.jsx?/,
exclude: /node_modules/,
use: [
'babel-loader',
{
loader: 'eslint-loader'
}
'babel-loader'
],
}, {
test: /\.scss$/,
Expand Down