aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/config/jest
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-11-01 13:41:25 +0100
committerGitHub <noreply@github.com>2017-11-01 13:41:25 +0100
commitee9b4cce454a518b0ae67f04efd967d618f69872 (patch)
tree1bfeb0cbb5ce28785bdeb0bf8f343feed9081a8c /server/sonar-web/config/jest
parent67fe4ce8f2d9f12704d829e95f1927b5698f1830 (diff)
downloadsonarqube-ee9b4cce454a518b0ae67f04efd967d618f69872.tar.gz
sonarqube-ee9b4cce454a518b0ae67f04efd967d618f69872.zip
Update to React 16 and Enzyme 3 (#2776)
* Update to React 16 * Add missing promise catch * Fix jest tests * extract react-dom mock * remove empty snapshots * Fix modals
Diffstat (limited to 'server/sonar-web/config/jest')
-rw-r--r--server/sonar-web/config/jest/SetupEnzyme.js23
-rw-r--r--server/sonar-web/config/jest/SetupTestEnvironment.js6
2 files changed, 29 insertions, 0 deletions
diff --git a/server/sonar-web/config/jest/SetupEnzyme.js b/server/sonar-web/config/jest/SetupEnzyme.js
new file mode 100644
index 00000000000..ec2ff5f0561
--- /dev/null
+++ b/server/sonar-web/config/jest/SetupEnzyme.js
@@ -0,0 +1,23 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import Enzyme from 'enzyme';
+import Adapter from 'enzyme-adapter-react-16';
+
+Enzyme.configure({ adapter: new Adapter() });
diff --git a/server/sonar-web/config/jest/SetupTestEnvironment.js b/server/sonar-web/config/jest/SetupTestEnvironment.js
index 64c8d0c15aa..c5d8747dde5 100644
--- a/server/sonar-web/config/jest/SetupTestEnvironment.js
+++ b/server/sonar-web/config/jest/SetupTestEnvironment.js
@@ -22,3 +22,9 @@ window.t = window.tp = function() {
const args = Array.prototype.slice.call(arguments, 0);
return args.join('.');
};
+
+// Fix for https://github.com/facebook/jest/issues/4545
+// Try to remove when jest 21.3.0 is out
+window.requestAnimationFrame = function(callback) {
+ setTimeout(callback, 0);
+};