Browse Source

chore(deps): Upgrade jest to v27 (#26393)

Upgrades to `jest@27`
Billy Vong 3 years ago
parent
commit
dd18ff6d78

+ 4 - 4
package.json

@@ -152,11 +152,11 @@
     "@storybook/manager-webpack5": "6.3.4",
     "@storybook/react": "6.3.4",
     "@storybook/theming": "6.3.4",
-    "@visual-snapshot/jest": "^3.0.0",
+    "@visual-snapshot/jest": "5.0.0",
     "@wojtekmaj/enzyme-adapter-react-17": "0.6.1",
     "babel-eslint": "^10.1.0",
     "babel-gettext-extractor": "^4.1.3",
-    "babel-jest": "26.6.3",
+    "babel-jest": "27.0.6",
     "babel-plugin-dynamic-import-node": "^2.2.0",
     "csstype": "^3.0.8",
     "enzyme": "3.11.0",
@@ -165,9 +165,9 @@
     "eslint-config-sentry-app": "1.58.0",
     "eslint-plugin-simple-import-sort": "^6.0.0",
     "html-webpack-plugin": "^5.3.2",
-    "jest": "26.6.3",
+    "jest": "27.0.6",
     "jest-canvas-mock": "^2.3.1",
-    "jest-circus": "26.6.3",
+    "jest-circus": "27.0.6",
     "jest-fetch-mock": "^3.0.3",
     "jest-junit": "^9.0.0",
     "mockdate": "3.0.5",

+ 6 - 11
tests/js/instrumentedEnv/index.js

@@ -12,8 +12,10 @@ function isNotTransaction(span) {
 }
 
 class SentryEnvironment extends JsDomEnvironment {
-  constructor(config, context) {
-    super(config, context);
+  constructor(...args) {
+    super(...args);
+
+    const [config, context] = args;
 
     if (!config.testEnvironmentOptions || !config.testEnvironmentOptions.SENTRY_DSN) {
       return;
@@ -38,7 +40,6 @@ class SentryEnvironment extends JsDomEnvironment {
       await super.setup();
       return;
     }
-
     this.transaction = Sentry.startTransaction({
       op: 'jest test suite',
       description: this.testPath,
@@ -48,9 +49,7 @@ class SentryEnvironment extends JsDomEnvironment {
         commit: process.env.GITHUB_SHA,
       },
     });
-
     Sentry.configureScope(scope => scope.setSpan(this.transaction));
-
     const span = this.transaction.startChild({
       op: 'setup',
       description: this.testPath,
@@ -64,18 +63,15 @@ class SentryEnvironment extends JsDomEnvironment {
       await super.teardown();
       return;
     }
-
     const span = this.transaction.startChild({
       op: 'teardown',
       description: this.testPath,
     });
     await super.teardown();
     span.finish();
-
     if (this.transaction) {
       this.transaction.finish();
     }
-
     this.runDescribe = null;
     this.testContainers = null;
     this.tests = null;
@@ -84,9 +80,8 @@ class SentryEnvironment extends JsDomEnvironment {
     this.Sentry = null;
   }
 
-  runScript(script) {
-    // We are intentionally not instrumenting this as it will produce hundreds of spans.
-    return super.runScript(script);
+  getVmContext() {
+    return super.getVmContext();
   }
 
   getName(parent) {

+ 6 - 2
tests/js/jest-pegjs-transform.js

@@ -4,8 +4,12 @@
 const crypto = require('crypto');
 const peg = require('pegjs');
 
-function getCacheKey(fileData, _filePath, configString, _options) {
-  return crypto.createHash('md5').update(fileData).update(configString).digest('hex');
+function getCacheKey(fileData, _filePath, config, _options) {
+  return crypto
+    .createHash('md5')
+    .update(fileData)
+    .update(config.configString)
+    .digest('hex');
 }
 
 function process(sourceText) {

+ 0 - 6
tests/js/spec/components/settingsBreadcrumbDropdown.spec.jsx

@@ -4,8 +4,6 @@ import BreadcrumbDropdown from 'app/views/settings/components/settingsBreadcrumb
 
 jest.useFakeTimers();
 
-const CLOSE_DELAY = 0;
-
 describe('Settings Breadcrumb Dropdown', function () {
   let wrapper;
   const selectMock = jest.fn();
@@ -35,10 +33,6 @@ describe('Settings Breadcrumb Dropdown', function () {
     expect(wrapper.find('BubbleWithMinWidth')).toHaveLength(1);
 
     wrapper.find('Crumb').simulate('mouseLeave');
-    // wonder what happens when this arg is negative o_O
-    jest.advanceTimersByTime(CLOSE_DELAY - 10);
-    wrapper.update();
-    expect(wrapper.find('BubbleWithMinWidth')).toHaveLength(1);
     jest.advanceTimersByTime(10);
     wrapper.update();
     expect(wrapper.find('BubbleWithMinWidth')).toHaveLength(0);

+ 1 - 3
tests/js/spec/views/sentryAppExternalInstallation.spec.jsx

@@ -100,8 +100,6 @@ describe('SentryAppExternalInstallation', () => {
         body: install,
       });
 
-      window.location.assign = jest.fn();
-
       wrapper = getMountedComponent();
       await tick();
       wrapper.update();
@@ -120,7 +118,7 @@ describe('SentryAppExternalInstallation', () => {
       expect(window.location.assign).toHaveBeenCalledWith(
         `https://google.com/?code=${install.code}&installationId=${install.uuid}&orgSlug=${org1.slug}`
       );
-      window.location.assign.mockRestore();
+      window.location.assign.mockClear();
     });
   });
   describe('multiple organizations', () => {

File diff suppressed because it is too large
+ 224 - 331
yarn.lock


Some files were not shown because too many files changed in this diff