From a66954497e8ace0fb334321bafa0d6862ec855a9 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Mon, 18 Dec 2017 20:51:06 +0000 Subject: [PATCH 01/26] chore(package): update babel-jest to version 22.0.1 Closes #6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2c7960a..baadef9 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "homepage": "https://github.com/wimpyprogrammer/react-component-update#readme", "devDependencies": { "babel-cli": "^6.26.0", - "babel-jest": "^21.2.0", + "babel-jest": "^22.0.1", "babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-preset-es2015": "^6.24.1", "babel-preset-react": "^6.24.1", From 6e4a1dd6b1e5359a6849a3a10f0a0010862e8551 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Mon, 18 Dec 2017 22:00:07 +0000 Subject: [PATCH 02/26] chore(package): update jest to version 22.0.1 Closes #7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2c7960a..583e821 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "eslint-plugin-import": "^2.3.0", "eslint-plugin-jsx-a11y": "^6.0.2", "eslint-plugin-react": "^7.1.0", - "jest": "^21.2.1", + "jest": "^22.0.1", "lodash.uniqueid": "^4.0.1", "publish-please": "^2.3.1", "react": "*", From 86925c731f6b012a24747ceb446676aae77c2761 Mon Sep 17 00:00:00 2001 From: Drew Keller Date: Mon, 18 Dec 2017 18:26:42 -0600 Subject: [PATCH 03/26] Remove Node v4 build Drop support for Node v4 since Jest has dropped their support. Per http://facebook.github.io/jest/blog/2017/12/18/jest-22.html. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 67a7f9b..6f32af8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ node_js: - "8" - "7" - "6" - - "4" env: - REACT_VERSION=0.13 - REACT_VERSION=0.14 From a15b635d76bdae79a375a576e6f452ebf521d3a0 Mon Sep 17 00:00:00 2001 From: Drew Keller Date: Sat, 23 Dec 2017 13:15:34 -0600 Subject: [PATCH 04/26] Remove extra Node builds Only test the oldest Node LTS version that we support and the latest stable Node version. --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6f32af8..39e1e87 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,6 @@ language: node_js node_js: - "node" - - "8" - - "7" - "6" env: - REACT_VERSION=0.13 From edff8b7324436a02444238ac49d25cbfb1faedb2 Mon Sep 17 00:00:00 2001 From: Drew Keller Date: Sat, 23 Dec 2017 13:23:42 -0600 Subject: [PATCH 05/26] Use Enzyme helper to install relevant adapter Replace custom code with third-party library. --- package.json | 1 + test-setup.js | 13 +++---------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 73adfe4..168d192 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "dirty-chai": "^2.0.0", "enzyme": "^3.1.0", "enzyme-adapter-react-16": "^1.0.1", + "enzyme-adapter-react-helper": "^1.2.2", "eslint": "^4.12.1", "eslint-config-airbnb": "^16.1.0", "eslint-plugin-import": "^2.3.0", diff --git a/test-setup.js b/test-setup.js index eea9bcb..185f503 100644 --- a/test-setup.js +++ b/test-setup.js @@ -1,11 +1,4 @@ -/* eslint-disable global-require, import/no-extraneous-dependencies, import/no-unresolved */ -const { configure } = require('enzyme'); -const reactVersion = require('react').version; +/* eslint-env mocha */ +import configure from 'enzyme-adapter-react-helper'; -const [majorReactVersion, minorReactVersion] = reactVersion.split('.'); -const adapterVersion = (majorReactVersion !== '0') ? majorReactVersion : minorReactVersion; - -// eslint-disable-next-line import/no-dynamic-require -const Adapter = require(`enzyme-adapter-react-${adapterVersion}`); - -configure({ adapter: new Adapter() }); +configure(); From ed477851ada6b52b8f8c7366d2b76e44afabbf6e Mon Sep 17 00:00:00 2001 From: Drew Keller Date: Sat, 23 Dec 2017 13:24:52 -0600 Subject: [PATCH 06/26] Use Enzyme helper to install build dependencies Replace custom install script with third-party library. --- .travis.yml | 10 ++++------ install-dependencies.sh | 29 ----------------------------- package.json | 3 ++- 3 files changed, 6 insertions(+), 36 deletions(-) delete mode 100755 install-dependencies.sh diff --git a/.travis.yml b/.travis.yml index 39e1e87..a87965a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,11 +3,9 @@ node_js: - "node" - "6" env: - - REACT_VERSION=0.13 - - REACT_VERSION=0.14 - - REACT_VERSION=15 - - REACT_VERSION=16 -before_script: - - ./install-dependencies.sh || echo "ignoring errors during setup" + - REACT=0.13 + - REACT=0.14 + - REACT=15 + - REACT=16 script: - npm run travisci diff --git a/install-dependencies.sh b/install-dependencies.sh deleted file mode 100755 index c1c6841..0000000 --- a/install-dependencies.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -set -ev - -REACT_VERSION_NORMALIZED=$REACT_VERSION -if [ "${REACT_VERSION:0:2}" = "0." ]; then - REACT_VERSION_NORMALIZED=${REACT_VERSION:2} -fi - -echo "installing React $REACT_VERSION ($REACT_VERSION_NORMALIZED)" -echo "Travis Node Version $TRAVIS_NODE_VERSION" -node --version -npm --version - -npm uninstall --no-save react react-dom react-addons-test-utils react-test-renderer enzyme-adapter-react-16 -rm -rf node_modules/.bin/npm node_modules/.bin/npm.cmd node_modules/react node_modules/react-dom node_modules/react-addons-test-utils node_modules/react-test-renderer node_modules/enzyme-adapter-react-16 -npm prune - -# Conditionally install dependencies per https://github.com/airbnb/enzyme#installation -if [ "${REACT_VERSION_NORMALIZED}" = "13" ]; then - npm install --no-save react@$REACT_VERSION enzyme-adapter-react-$REACT_VERSION_NORMALIZED -elif [ "${REACT_VERSION_NORMALIZED}" = "14" ]; then - npm install --no-save react@$REACT_VERSION react-dom@$REACT_VERSION react-addons-test-utils@$REACT_VERSION enzyme-adapter-react-$REACT_VERSION_NORMALIZED -elif [ "${REACT_VERSION_NORMALIZED}" = "15" ]; then - npm install --no-save react@$REACT_VERSION react-dom@$REACT_VERSION react-test-renderer@$REACT_VERSION enzyme-adapter-react-$REACT_VERSION_NORMALIZED -else # React 16+ - npm install --no-save react@$REACT_VERSION react-dom@$REACT_VERSION enzyme-adapter-react-$REACT_VERSION_NORMALIZED -fi - -npm ls --depth=0 diff --git a/package.json b/package.json index 168d192..bab7ed2 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,10 @@ "scripts": { "clean": "rimraf lib", "build": "npm run clean && babel src --out-dir lib", + "install-react": "enzyme-adapter-react-install 16", "lint": "eslint ./", "test": "jest", - "travisci": "npm run lint && jest && codecov", + "travisci": "npm run install-react && npm run lint && npm run test && codecov", "publish-please": "publish-please", "prepublish": "publish-please guard" }, From 1166a3436c356d466d3cfc8d31554252e662c018 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Tue, 6 Mar 2018 07:28:14 +0000 Subject: [PATCH 07/26] chore(package): update sinon-chai to version 3.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 73adfe4..07855ef 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "react-test-renderer": "*", "rimraf": "^2.6.1", "sinon": "^4.1.2", - "sinon-chai": "^2.13.0" + "sinon-chai": "^3.0.0" }, "peerDependencies": { "react": "*" From d2655a1f8688f7ca886e2aeeaa23f9551a3034ed Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Wed, 21 Mar 2018 18:24:24 +0000 Subject: [PATCH 08/26] chore(package): update sinon to version 5.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 07855ef..c980a97 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "react-dom": "*", "react-test-renderer": "*", "rimraf": "^2.6.1", - "sinon": "^4.1.2", + "sinon": "^5.0.0", "sinon-chai": "^3.0.0" }, "peerDependencies": { From d56363853275e43ad348120bf6bc342da098a263 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Thu, 24 May 2018 19:03:43 +0000 Subject: [PATCH 09/26] chore(package): update babel-jest to version 23.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c980a97..fc4a30c 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "homepage": "https://github.com/wimpyprogrammer/react-component-update#readme", "devDependencies": { "babel-cli": "^6.26.0", - "babel-jest": "^22.0.1", + "babel-jest": "^23.0.0", "babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-preset-es2015": "^6.24.1", "babel-preset-react": "^6.24.1", From a6dde7ae84a950414967fa86707d62928e3a44fb Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Fri, 22 Jun 2018 00:57:20 +0000 Subject: [PATCH 10/26] chore(package): update eslint-config-airbnb to version 17.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc4a30c..9ad653e 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "enzyme": "^3.1.0", "enzyme-adapter-react-16": "^1.0.1", "eslint": "^4.12.1", - "eslint-config-airbnb": "^16.1.0", + "eslint-config-airbnb": "^17.0.0", "eslint-plugin-import": "^2.3.0", "eslint-plugin-jsx-a11y": "^6.0.2", "eslint-plugin-react": "^7.1.0", From 08ff8fff50c8b4e49aaf4c955a624268d34cd861 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Sun, 24 Jun 2018 19:30:23 +0000 Subject: [PATCH 11/26] chore(package): update sinon to version 6.0.1 Closes #19 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc4a30c..beb187e 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "react-dom": "*", "react-test-renderer": "*", "rimraf": "^2.6.1", - "sinon": "^5.0.0", + "sinon": "^6.0.1", "sinon-chai": "^3.0.0" }, "peerDependencies": { From 3f894e1f5c39ed69391f455637daa3322a01f0ba Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Mon, 25 Jun 2018 17:59:45 +0000 Subject: [PATCH 12/26] chore(package): update publish-please to version 3.1.0 Closes #18 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc4a30c..95ff128 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "eslint-plugin-react": "^7.1.0", "jest": "^22.0.1", "lodash.uniqueid": "^4.0.1", - "publish-please": "^2.3.1", + "publish-please": "^3.1.0", "react": "*", "react-dom": "*", "react-test-renderer": "*", From ccb765437b0fafb2a6ba21d2e4f7b504742b83ed Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Tue, 26 Jun 2018 07:25:23 +0000 Subject: [PATCH 13/26] chore(package): update eslint to version 5.0.1 Closes #21 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc4a30c..10b722b 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "dirty-chai": "^2.0.0", "enzyme": "^3.1.0", "enzyme-adapter-react-16": "^1.0.1", - "eslint": "^4.12.1", + "eslint": "^5.0.1", "eslint-config-airbnb": "^16.1.0", "eslint-plugin-import": "^2.3.0", "eslint-plugin-jsx-a11y": "^6.0.2", From 94e3415dea4f982eacb5e210c76d25b5d85e3dbc Mon Sep 17 00:00:00 2001 From: Drew Keller Date: Wed, 27 Jun 2018 23:38:16 -0500 Subject: [PATCH 14/26] Cache npm dependencies in TravisCI Enable node_modules caching in Travis CI per https://docs.travis-ci.com/user/caching/. This may help with builds that stall during "npm install". --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 6f32af8..72f23ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,3 +13,6 @@ before_script: - ./install-dependencies.sh || echo "ignoring errors during setup" script: - npm run travisci +cache: + directories: + - node_modules From 4ac8834800355f39514f9ec0f0184e0b4aef3b6b Mon Sep 17 00:00:00 2001 From: Drew Keller Date: Fri, 29 Jun 2018 19:20:48 -0500 Subject: [PATCH 15/26] Fix lines-between-class-members ESLint errors --- src/component.spec.js | 11 +++++++---- src/pureComponent.spec.js | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/component.spec.js b/src/component.spec.js index 04f38b0..33cae97 100644 --- a/src/component.spec.js +++ b/src/component.spec.js @@ -303,10 +303,13 @@ describe('Component extension with overrides calling super()', () => { describe('Component extension with overrides not calling super()', () => { class TestComponentWithoutSuper extends Component { - componentWillMount() {} - componentDidMount() {} - componentWillReceiveProps() {} - componentDidUpdate() {} + componentWillMount() { } + + componentDidMount() { } + + componentWillReceiveProps() { } + + componentDidUpdate() { } render() { return null; diff --git a/src/pureComponent.spec.js b/src/pureComponent.spec.js index 5dfaaa9..a5c6be2 100644 --- a/src/pureComponent.spec.js +++ b/src/pureComponent.spec.js @@ -300,10 +300,13 @@ descriptor('Component extension with overrides not calling super()', () => { const { PureComponent } = require('./'); // eslint-disable-line global-require class TestComponentWithoutSuper extends PureComponent { - componentWillMount() {} - componentDidMount() {} - componentWillReceiveProps() {} - componentDidUpdate() {} + componentWillMount() { } + + componentDidMount() { } + + componentWillReceiveProps() { } + + componentDidUpdate() { } render() { return null; From 32a2be405dc78ceb46344d0dee6cb75c8997b5df Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Mon, 16 Jul 2018 10:56:18 +0000 Subject: [PATCH 16/26] chore(package): update publish-please to version 3.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 00142d4..59402f8 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "eslint-plugin-react": "^7.1.0", "jest": "^22.0.1", "lodash.uniqueid": "^4.0.1", - "publish-please": "^3.1.0", + "publish-please": "^3.2.0", "react": "*", "react-dom": "*", "react-test-renderer": "*", From ae6ad1bc0d50213e1deaf42963f61680f2152c6e Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Mon, 13 Aug 2018 23:46:52 +0000 Subject: [PATCH 17/26] fix: pin eslint-config-airbnb to 17.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 00142d4..1f2dc29 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "enzyme": "^3.1.0", "enzyme-adapter-react-16": "^1.0.1", "eslint": "^5.0.1", - "eslint-config-airbnb": "^17.0.0", + "eslint-config-airbnb": "17.0.0", "eslint-plugin-import": "^2.3.0", "eslint-plugin-jsx-a11y": "^6.0.2", "eslint-plugin-react": "^7.1.0", From 01ed5dd6564bfdfa8330fb7b551c124a024990c2 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Sat, 18 Aug 2018 00:03:42 +0000 Subject: [PATCH 18/26] chore(package): update enzyme to version 3.4.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 00142d4..cf90a72 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "codecov": "^3.0.0", "create-react-class": "^15.6.0", "dirty-chai": "^2.0.0", - "enzyme": "^3.1.0", + "enzyme": "^3.4.4", "enzyme-adapter-react-16": "^1.0.1", "eslint": "^5.0.1", "eslint-config-airbnb": "^17.0.0", From ba645d5b1914b2bdc9a070e813a409c96876d08d Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Sat, 18 Aug 2018 00:06:54 +0000 Subject: [PATCH 19/26] chore(package): update enzyme-adapter-react-16 to version 1.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cf90a72..3a58d94 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "create-react-class": "^15.6.0", "dirty-chai": "^2.0.0", "enzyme": "^3.4.4", - "enzyme-adapter-react-16": "^1.0.1", + "enzyme-adapter-react-16": "^1.2.0", "eslint": "^5.0.1", "eslint-config-airbnb": "^17.0.0", "eslint-plugin-import": "^2.3.0", From e82249ba0a5465304cb6c47e18672d26eb6b98b7 Mon Sep 17 00:00:00 2001 From: Drew Keller Date: Sat, 18 Aug 2018 23:41:06 -0500 Subject: [PATCH 20/26] Upgrade lint plugins for ESLint v5 compatibility Bump to the compatible versions listed in airbnb/javascript#1834. --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 1f2dc29..8ee571c 100644 --- a/package.json +++ b/package.json @@ -38,10 +38,10 @@ "enzyme": "^3.1.0", "enzyme-adapter-react-16": "^1.0.1", "eslint": "^5.0.1", - "eslint-config-airbnb": "17.0.0", - "eslint-plugin-import": "^2.3.0", - "eslint-plugin-jsx-a11y": "^6.0.2", - "eslint-plugin-react": "^7.1.0", + "eslint-config-airbnb": "^17.1.0", + "eslint-plugin-import": "^2.13.0", + "eslint-plugin-jsx-a11y": "^6.1.0", + "eslint-plugin-react": "^7.11.0", "jest": "^22.0.1", "lodash.uniqueid": "^4.0.1", "publish-please": "^3.1.0", From 41319c3edafd846b7af628b04b9ec049d6179e5b Mon Sep 17 00:00:00 2001 From: Drew Keller Date: Sun, 19 Aug 2018 00:08:07 -0500 Subject: [PATCH 21/26] Upgrade Jest to fix SecurityError test failures Bump Jest to 23.5 per facebook/jest#6766 to fix error: SecurityError: localStorage is not available for opaque origins --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8ee571c..4dde366 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "eslint-plugin-import": "^2.13.0", "eslint-plugin-jsx-a11y": "^6.1.0", "eslint-plugin-react": "^7.11.0", - "jest": "^22.0.1", + "jest": "^23.5.0", "lodash.uniqueid": "^4.0.1", "publish-please": "^3.1.0", "react": "*", From 4c6fe8849332d31a3f2ede78b9feb278ac21fbdb Mon Sep 17 00:00:00 2001 From: Drew Keller Date: Sun, 19 Aug 2018 20:04:29 -0500 Subject: [PATCH 22/26] Add badge for npm package --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 05c78c2..120ffb5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # react-component-update +[![npm package](https://badge.fury.io/js/react-component-update.svg)](https://badge.fury.io/js/react-component-update) [![Build Status](https://travis-ci.org/wimpyprogrammer/react-component-update.svg?branch=master)](https://travis-ci.org/wimpyprogrammer/react-component-update) [![codecov](https://codecov.io/gh/wimpyprogrammer/react-component-update/branch/master/graph/badge.svg)](https://codecov.io/gh/wimpyprogrammer/react-component-update) [![Known Vulnerabilities](https://snyk.io/test/github/wimpyprogrammer/react-component-update/badge.svg)](https://snyk.io/test/github/wimpyprogrammer/react-component-update) From 8acb11be19e10f179b32a88873d8529c75d658fb Mon Sep 17 00:00:00 2001 From: Drew Keller Date: Sun, 19 Aug 2018 20:26:53 -0500 Subject: [PATCH 23/26] Specify supported node versions --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 1767c51..f4ba8ee 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,9 @@ "files": [ "lib/**/!(*.spec).js" ], + "engines": { + "node": ">=6" + }, "scripts": { "clean": "rimraf lib", "build": "npm run clean && babel src --out-dir lib", From 946362e85bd98b4720cb5016c8d55305f14c30f0 Mon Sep 17 00:00:00 2001 From: Drew Keller Date: Sun, 19 Aug 2018 20:27:23 -0500 Subject: [PATCH 24/26] Add badge for node versions --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 120ffb5..302a280 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # react-component-update [![npm package](https://badge.fury.io/js/react-component-update.svg)](https://badge.fury.io/js/react-component-update) +![node version](https://img.shields.io/node/v/react-component-update.svg) [![Build Status](https://travis-ci.org/wimpyprogrammer/react-component-update.svg?branch=master)](https://travis-ci.org/wimpyprogrammer/react-component-update) [![codecov](https://codecov.io/gh/wimpyprogrammer/react-component-update/branch/master/graph/badge.svg)](https://codecov.io/gh/wimpyprogrammer/react-component-update) [![Known Vulnerabilities](https://snyk.io/test/github/wimpyprogrammer/react-component-update/badge.svg)](https://snyk.io/test/github/wimpyprogrammer/react-component-update) From c38e64452d5e0431753ca79e9c24faf669bf811c Mon Sep 17 00:00:00 2001 From: Drew Keller Date: Sun, 19 Aug 2018 21:25:15 -0500 Subject: [PATCH 25/26] Use shallow() for Enzyme tests Replace mount() to improve test speed and scope. --- src/component.spec.js | 22 +++++++++++----------- src/pureComponent.spec.js | 20 ++++++++++---------- src/withEvents.spec.js | 18 +++++++++--------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/component.spec.js b/src/component.spec.js index 33cae97..55060ae 100644 --- a/src/component.spec.js +++ b/src/component.spec.js @@ -2,7 +2,7 @@ /* eslint-disable react/no-multi-comp */ import chai, { expect } from 'chai'; import dirtyChai from 'dirty-chai'; -import { mount } from 'enzyme'; +import { shallow } from 'enzyme'; import uniqueId from 'lodash.uniqueid'; import React from 'react'; import sinon from 'sinon'; @@ -41,7 +41,7 @@ describe('Component extension', () => { const callbackRender = sandbox.spy(TestComponent.prototype, 'render'); beforeEach(() => { - component = mount(); + component = shallow(); }); afterEach(() => sandbox.reset()); @@ -52,7 +52,7 @@ describe('Component extension', () => { }); it('runs on mount with first parameter of component props', () => { - expect(callbackWill.firstCall).to.have.been.calledWith(component.props()); + expect(callbackWill.firstCall).to.have.been.calledWith(component.instance().props); }); it('runs on mount with "this" context of component', () => { @@ -69,13 +69,13 @@ describe('Component extension', () => { }); it('runs on props update when no props change', () => { - component.setProps(component.props()); + component.setProps(component.instance().props); expect(callbackWill).to.have.been.calledTwice(); }); it('runs on props update with first parameter of component props', () => { component.setProps(getUniqueProps()); - expect(callbackWill.secondCall).to.have.been.calledWith(component.props()); + expect(callbackWill.secondCall).to.have.been.calledWith(component.instance().props); }); it('runs on props update with "this" context of component', () => { @@ -100,7 +100,7 @@ describe('Component extension', () => { }); it('runs on mount with first parameter of component props', () => { - expect(callbackDid.firstCall).to.have.been.calledWith(component.props()); + expect(callbackDid.firstCall).to.have.been.calledWith(component.instance().props); }); it('runs on mount with second parameter of component state', () => { @@ -121,12 +121,12 @@ describe('Component extension', () => { }); it('runs on props update when no props change', () => { - component.setProps(component.props()); + component.setProps(component.instance().props); expect(callbackDid).to.have.been.calledTwice(); }); it('runs on props update with first parameter of previous component props', () => { - const initialProps = component.props(); + const initialProps = component.instance().props; component.setProps(getUniqueProps()); expect(callbackDid.secondCall).to.have.been.calledWith(initialProps); }); @@ -153,7 +153,7 @@ describe('Component extension', () => { }); it('runs on state update with first parameter of previous component props', () => { - const initialProps = component.props(); + const initialProps = component.instance().props; component.setState(getUniqueState()); expect(callbackDid.secondCall).to.have.been.calledWith(initialProps); }); @@ -220,7 +220,7 @@ describe('Component extension with overrides calling super()', () => { const callbackDid = sandbox.spy(TestComponentWithSuper.prototype, 'componentDidMountOrUpdate'); beforeEach(() => { - component = mount(); + component = shallow(); }); afterEach(() => sandbox.reset()); @@ -320,7 +320,7 @@ describe('Component extension with overrides not calling super()', () => { const callbackDid = sandbox.spy(TestComponentWithoutSuper.prototype, 'componentDidMountOrUpdate'); beforeEach(() => { - component = mount(); + component = shallow(); }); afterEach(() => sandbox.reset()); diff --git a/src/pureComponent.spec.js b/src/pureComponent.spec.js index a5c6be2..c70a1e2 100644 --- a/src/pureComponent.spec.js +++ b/src/pureComponent.spec.js @@ -2,7 +2,7 @@ /* eslint-disable react/no-multi-comp */ import chai, { expect } from 'chai'; import dirtyChai from 'dirty-chai'; -import { mount } from 'enzyme'; +import { shallow } from 'enzyme'; import uniqueId from 'lodash.uniqueid'; import React from 'react'; import sinon from 'sinon'; @@ -44,7 +44,7 @@ descriptor('PureComponent extension', () => { const callbackRender = sandbox.spy(TestComponent.prototype, 'render'); beforeEach(() => { - component = mount(); + component = shallow(); }); afterEach(() => sandbox.reset()); @@ -55,7 +55,7 @@ descriptor('PureComponent extension', () => { }); it('runs on mount with first parameter of component props', () => { - expect(callbackWill.firstCall).to.have.been.calledWith(component.props()); + expect(callbackWill.firstCall).to.have.been.calledWith(component.instance().props); }); it('runs on mount with "this" context of component', () => { @@ -72,13 +72,13 @@ descriptor('PureComponent extension', () => { }); it('runs on props update when no props change', () => { - component.setProps(component.props()); + component.setProps(component.instance().props); expect(callbackWill).to.have.been.calledTwice(); }); it('runs on props update with first parameter of component props', () => { component.setProps(getUniqueProps()); - expect(callbackWill.secondCall).to.have.been.calledWith(component.props()); + expect(callbackWill.secondCall).to.have.been.calledWith(component.instance().props); }); it('runs on props update with "this" context of component', () => { @@ -103,7 +103,7 @@ descriptor('PureComponent extension', () => { }); it('runs on mount with first parameter of component props', () => { - expect(callbackDid.firstCall).to.have.been.calledWith(component.props()); + expect(callbackDid.firstCall).to.have.been.calledWith(component.instance().props); }); it('runs on mount with second parameter of component state', () => { @@ -124,7 +124,7 @@ descriptor('PureComponent extension', () => { }); it('runs on props update with first parameter of previous component props', () => { - const initialProps = component.props(); + const initialProps = component.instance().props; component.setProps(getUniqueProps()); expect(callbackDid.secondCall).to.have.been.calledWith(initialProps); }); @@ -146,7 +146,7 @@ descriptor('PureComponent extension', () => { }); it('runs on state update with first parameter of previous component props', () => { - const initialProps = component.props(); + const initialProps = component.instance().props; component.setState(getUniqueState()); expect(callbackDid.secondCall).to.have.been.calledWith(initialProps); }); @@ -215,7 +215,7 @@ descriptor('PureComponent extension with overrides calling super()', () => { const callbackDid = sandbox.spy(TestComponentWithSuper.prototype, 'componentDidMountOrUpdate'); beforeEach(() => { - component = mount(); + component = shallow(); }); afterEach(() => sandbox.reset()); @@ -317,7 +317,7 @@ descriptor('Component extension with overrides not calling super()', () => { const callbackDid = sandbox.spy(TestComponentWithoutSuper.prototype, 'componentDidMountOrUpdate'); beforeEach(() => { - component = mount(); + component = shallow(); }); afterEach(() => sandbox.reset()); diff --git a/src/withEvents.spec.js b/src/withEvents.spec.js index 1669e03..a655b1d 100644 --- a/src/withEvents.spec.js +++ b/src/withEvents.spec.js @@ -2,7 +2,7 @@ import chai, { expect } from 'chai'; import createReactClass from 'create-react-class'; import dirtyChai from 'dirty-chai'; -import { mount } from 'enzyme'; +import { shallow } from 'enzyme'; import uniqueId from 'lodash.uniqueid'; import React from 'react'; import sinon from 'sinon'; @@ -37,7 +37,7 @@ describe('withEvents extension', () => { const callbackRender = sandbox.spy(TestComponent.prototype, 'render'); beforeEach(() => { - component = mount(); + component = shallow(); }); afterEach(() => sandbox.reset()); @@ -48,7 +48,7 @@ describe('withEvents extension', () => { }); it('runs on mount with first parameter of component props', () => { - expect(callbackWill.firstCall).to.have.been.calledWith(component.props()); + expect(callbackWill.firstCall).to.have.been.calledWith(component.instance().props); }); it('runs on mount with "this" context of component', () => { @@ -65,13 +65,13 @@ describe('withEvents extension', () => { }); it('runs on props update when no props change', () => { - component.setProps(component.props()); + component.setProps(component.instance().props); expect(callbackWill).to.have.been.calledTwice(); }); it('runs on props update with first parameter of component props', () => { component.setProps(getUniqueProps()); - expect(callbackWill.secondCall).to.have.been.calledWith(component.props()); + expect(callbackWill.secondCall).to.have.been.calledWith(component.instance().props); }); it('runs on props update with "this" context of component', () => { @@ -96,7 +96,7 @@ describe('withEvents extension', () => { }); it('runs on mount with first parameter of component props', () => { - expect(callbackDid.firstCall).to.have.been.calledWith(component.props()); + expect(callbackDid.firstCall).to.have.been.calledWith(component.instance().props); }); it('runs on mount with second parameter of component state', () => { @@ -117,7 +117,7 @@ describe('withEvents extension', () => { }); it('runs on props update with first parameter of previous component props', () => { - const initialProps = component.props(); + const initialProps = component.instance().props; component.setProps(getUniqueProps()); expect(callbackDid.secondCall).to.have.been.calledWith(initialProps); }); @@ -139,7 +139,7 @@ describe('withEvents extension', () => { }); it('runs on state update with first parameter of previous component props', () => { - const initialProps = component.props(); + const initialProps = component.instance().props; component.setState(getUniqueState()); expect(callbackDid.secondCall).to.have.been.calledWith(initialProps); }); @@ -183,7 +183,7 @@ describe('withEvents extension with overrides', () => { })); beforeEach(() => { - component = mount(); + component = shallow(); }); afterEach(() => sandbox.reset()); From 4ce2592c2ad150e4187cbe6bbe1c2a780a283b2e Mon Sep 17 00:00:00 2001 From: Drew Keller Date: Sun, 19 Aug 2018 22:04:04 -0500 Subject: [PATCH 26/26] Bump minor version to 1.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f4ba8ee..6c68390 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-component-update", - "version": "1.1.1", + "version": "1.2.0", "description": "Extends the native React Component to streamline updates", "main": "lib/index.js", "files": [