diff --git a/ui/package-lock.json b/ui/package-lock.json index 0c5fc77b1..e2e6dfd98 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -12194,14 +12194,13 @@ } }, "react": { - "version": "16.8.6", - "resolved": "https://registry.npmjs.org/react/-/react-16.8.6.tgz", - "integrity": "sha512-pC0uMkhLaHm11ZSJULfOBqV4tIZkx87ZLvbbQYunNixAAvjnC+snJCg0XQXn9VIsttVsbZP/H/ewzgsd5fxKXw==", + "version": "16.9.0", + "resolved": "https://registry.npmjs.org/react/-/react-16.9.0.tgz", + "integrity": "sha512-+7LQnFBwkiw+BobzOF6N//BdoNw0ouwmSJTEm9cglOOmsg/TMiFHZLe2sEoN5M7LgJTj9oHH0gxklfnQe66S1w==", "requires": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1", - "prop-types": "^15.6.2", - "scheduler": "^0.13.6" + "prop-types": "^15.6.2" } }, "react-app-polyfill": { @@ -12335,14 +12334,25 @@ } }, "react-dom": { - "version": "16.8.6", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.8.6.tgz", - "integrity": "sha512-1nL7PIq9LTL3fthPqwkvr2zY7phIPjYrT0jp4HjyEQrEROnw4dG41VVwi/wfoCneoleqrNX7iAD+pXebJZwrwA==", + "version": "16.9.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.9.0.tgz", + "integrity": "sha512-YFT2rxO9hM70ewk9jq0y6sQk8cL02xm4+IzYBz75CQGlClQQ1Bxq0nhHF6OtSbit+AIahujJgb/CPRibFkMNJQ==", "requires": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1", "prop-types": "^15.6.2", - "scheduler": "^0.13.6" + "scheduler": "^0.15.0" + }, + "dependencies": { + "scheduler": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.15.0.tgz", + "integrity": "sha512-xAefmSfN6jqAa7Kuq7LIJY0bwAPG3xlCj0HMEBQk1lxYiDKZscY2xJ5U/61ZTrYbmNQbXa+gc7czPkVo11tnCg==", + "requires": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1" + } + } } }, "react-error-overlay": { @@ -13412,6 +13422,7 @@ "version": "0.13.6", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.13.6.tgz", "integrity": "sha512-IWnObHt413ucAYKsD9J1QShUKkbKLQQHdxRyw73sw4FN26iWr3DY/H34xGPe4nmL1DwXyWmSWmMrA9TfQbE/XQ==", + "dev": true, "requires": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1" diff --git a/ui/package.json b/ui/package.json index 2d276fd90..85a61a879 100644 --- a/ui/package.json +++ b/ui/package.json @@ -28,11 +28,11 @@ "object-hash": "1.3.1", "prop-types": "15.7.2", "qs": "6.7.0", - "react": "16.8.6", + "react": "16.9.0", "react-app-polyfill": "1.0.1", "react-autosuggest": "9.4.3", "react-datepicker": "2.8.0", - "react-dom": "16.8.6", + "react-dom": "16.9.0", "react-highlighter": "0.4.3", "react-hotkeys": "2.0.0", "react-idle-timer": "4.2.8", diff --git a/ui/src/index.test.js b/ui/src/index.test.js index f46d8fb1f..acb9fe90a 100644 --- a/ui/src/index.test.js +++ b/ui/src/index.test.js @@ -38,4 +38,17 @@ describe("console", () => { console.warn(); }).toThrowError("message=undefined args="); }); + + it("console.warn() with React deprecation warning doesn't throw any error", () => { + // https://reactjs.org/blog/2019/08/08/react-v16.9.0.html#new-deprecations + const msg = [ + "Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.", + "* Move code with side effects to componentDidMount, and set initial state in the constructor.", + "* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.", + "Please update the following components: foo" + ].join("\n"); + expect(() => { + console.warn(msg); + }).not.toThrow(); + }); }); diff --git a/ui/src/setupTests.js b/ui/src/setupTests.js index b1c5defd8..1233ffcd8 100644 --- a/ui/src/setupTests.js +++ b/ui/src/setupTests.js @@ -16,7 +16,11 @@ global.fetch = require("jest-fetch-mock"); // ensure that all console messages throw errors for (const level of ["error", "warn", "info", "log", "trace"]) { + // https://reactjs.org/blog/2019/08/08/react-v16.9.0.html#new-deprecations + const reactDeprecationWarning = /.*has been renamed, and is not recommended for use\. See https:\/\/fb.me\/react-async-component-lifecycle-hooks for details.*/; global.console[level] = (message, ...args) => { - throw new Error(`message=${message} args=${args}`); + if (reactDeprecationWarning.test(message) === false) { + throw new Error(`message=${message} args=${args}`); + } }; }