diff --git a/.eslintrc.js b/.eslintrc.js index 622d4d215..3da59788d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -2,51 +2,51 @@ module.exports = { root: true, env: { node: true, - "react-native/react-native": true, + 'react-native/react-native': true, }, - extends: ["@sentry-internal/sdk"], - plugins: ["@sentry-internal/sdk"], + extends: ['@sentry-internal/sdk'], + plugins: ['@sentry-internal/sdk'], parserOptions: { - project: "./tsconfig.json", + project: './tsconfig.json', }, settings: { - version: "detect", // React version. "detect" automatically picks the version you have installed. + version: 'detect', // React version. "detect" automatically picks the version you have installed. }, overrides: [ { // Typescript Files - files: ["*.ts", "*.tsx"], - extends: ["plugin:react/recommended"], - plugins: ["react", "react-native"], + files: ['*.ts', '*.tsx'], + extends: ['plugin:react/recommended'], + plugins: ['react', 'react-native'], rules: { - "@typescript-eslint/typedef": [ - "error", + '@typescript-eslint/typedef': [ + 'error', { arrowParameter: false, variableDeclarationIgnoreFunction: true }, ], }, }, { // Test Files - files: ["*.test.ts", "*.test.tsx", "*.test.js", "*.test.jsx"], + files: ['*.test.ts', '*.test.tsx', '*.test.js', '*.test.jsx'], rules: { - "@typescript-eslint/no-var-requires": "off", - "@typescript-eslint/no-empty-function": "off", - "@typescript-eslint/no-explicit-any": "off", + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/no-empty-function': 'off', + '@typescript-eslint/no-explicit-any': 'off', }, }, { // Scripts - files: ["scripts/*"], + files: ['scripts/*'], parserOptions: { ecmaVersion: 2015, }, rules: { - "no-console": "off", + 'no-console': 'off', }, }, ], rules: { // Bundle size isn't too much of an issue for React Native. - "@sentry-internal/sdk/no-async-await": "off", + '@sentry-internal/sdk/no-async-await': 'off', }, }; diff --git a/CHANGELOG.md b/CHANGELOG.md index da4d29ef9..7456c930f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 3.3.6 - fix: Respect given release if no dist is given during SDK init (#2163) +- Bump: @sentry/javascript dependencies to 6.19.2 (#2175) ## 3.3.5 diff --git a/babel.config.js b/babel.config.js index 5ae49c32b..f842b77fc 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,3 +1,3 @@ module.exports = { - presets: ["module:metro-react-native-babel-preset"], + presets: ['module:metro-react-native-babel-preset'], }; diff --git a/package.json b/package.json index 7ad9c4b03..6cfa017bd 100644 --- a/package.json +++ b/package.json @@ -40,21 +40,21 @@ "react-native": ">=0.56.0" }, "dependencies": { - "@sentry/browser": "6.17.9", - "@sentry/cli": "^1.72.0", - "@sentry/core": "6.17.9", - "@sentry/hub": "6.17.9", - "@sentry/integrations": "6.17.9", - "@sentry/react": "6.17.9", - "@sentry/tracing": "6.17.9", - "@sentry/types": "6.17.9", - "@sentry/utils": "6.17.9", + "@sentry/browser": "6.19.2", + "@sentry/cli": "^1.74.2", + "@sentry/core": "6.19.2", + "@sentry/hub": "6.19.2", + "@sentry/integrations": "6.19.2", + "@sentry/react": "6.19.2", + "@sentry/tracing": "6.19.2", + "@sentry/types": "6.19.2", + "@sentry/utils": "6.19.2", "@sentry/wizard": "^1.2.17" }, "devDependencies": { - "@sentry-internal/eslint-config-sdk": "6.17.9", - "@sentry-internal/eslint-plugin-sdk": "6.17.9", - "@sentry/typescript": "^5.20.0", + "@sentry-internal/eslint-config-sdk": "6.19.2", + "@sentry-internal/eslint-plugin-sdk": "6.19.2", + "@sentry/typescript": "^5.20.1", "@types/jest": "^26.0.15", "@types/react": "^16.9.49", "@types/react-native": "^0.66.11", diff --git a/react-native.config.js b/react-native.config.js index 59801ea31..f85fa01be 100644 --- a/react-native.config.js +++ b/react-native.config.js @@ -2,17 +2,17 @@ module.exports = { dependency: { platforms: { ios: { - sharedLibraries: ["libz"] + sharedLibraries: ['libz'] }, android: { - packageInstance: "new RNSentryPackage()" + packageInstance: 'new RNSentryPackage()' } }, hooks: { postlink: - "node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android", + 'node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android', postunlink: - "node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android --uninstall" + 'node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android --uninstall' } } }; diff --git a/sample/src/App.tsx b/sample/src/App.tsx index 077f440e8..39526d01a 100644 --- a/sample/src/App.tsx +++ b/sample/src/App.tsx @@ -19,11 +19,10 @@ import ReduxScreen from './screens/ReduxScreen'; import {store} from './reduxApp'; import {SENTRY_INTERNAL_DSN} from './dsn'; -const reactNavigationInstrumentation = new Sentry.ReactNavigationInstrumentation( - { +const reactNavigationInstrumentation = + new Sentry.ReactNavigationInstrumentation({ routeChangeTimeoutMs: 500, // How long it will wait for the route change to complete. Default is 1000ms - }, -); + }); Sentry.init({ // Replace the example DSN below with your own DSN: dsn: SENTRY_INTERNAL_DSN, @@ -60,8 +59,9 @@ Sentry.init({ tracesSampleRate: 1.0, // Sets the `release` and `dist` on Sentry events. Make sure this matches EXACTLY with the values on your sourcemaps // otherwise they will not work. - release: 'myapp@1.2.3+1', - dist: `1`, + // release: 'myapp@1.2.3+1', + // dist: `1`, + attachStacktrace: true, }); const Stack = createStackNavigator(); diff --git a/sample/src/screens/HomeScreen.tsx b/sample/src/screens/HomeScreen.tsx index 6b8d9c4ea..d01a3544d 100644 --- a/sample/src/screens/HomeScreen.tsx +++ b/sample/src/screens/HomeScreen.tsx @@ -9,11 +9,7 @@ import { View, } from 'react-native'; import {StackNavigationProp} from '@react-navigation/stack'; -import { - CommonActions, - useNavigation, - useNavigationState, -} from '@react-navigation/native'; +import {CommonActions} from '@react-navigation/native'; import * as Sentry from '@sentry/react-native'; diff --git a/sample/utils/fetchEvent.ts b/sample/utils/fetchEvent.ts index ae2e6dcee..055f809e9 100644 --- a/sample/utils/fetchEvent.ts +++ b/sample/utils/fetchEvent.ts @@ -3,7 +3,7 @@ import {Event} from '@sentry/types'; import fetch from 'node-fetch'; const domain = 'sentry.io'; -const eventEndpoint = `/api/0/projects/sentry-sdks/sentry-react-native/events/`; +const eventEndpoint = '/api/0/projects/sentry-sdks/sentry-react-native/events/'; interface ApiEvent extends Event { /** diff --git a/scripts/version-bump.js b/scripts/version-bump.js index 0bcad1481..4b1036068 100644 --- a/scripts/version-bump.js +++ b/scripts/version-bump.js @@ -1,15 +1,15 @@ -const replace = require("replace-in-file"); +const replace = require('replace-in-file'); -const pjson = require("../package.json"); +const pjson = require('../package.json'); replace({ - files: ["src/js/version.ts"], + files: ['src/js/version.ts'], from: /\d+\.\d+.\d+(?:-\w+(?:\.\w+)?)?/g, to: pjson.version, }) .then((changedFiles) => { - console.log("Modified files:", changedFiles.join(", ")); + console.log('Modified files:', changedFiles.join(', ')); }) .catch((error) => { - console.error("Error occurred:", error); + console.error('Error occurred:', error); }); diff --git a/src/js/backend.ts b/src/js/backend.ts index 2fa6f2ab1..827036f63 100644 --- a/src/js/backend.ts +++ b/src/js/backend.ts @@ -1,13 +1,13 @@ -import { BrowserBackend } from "@sentry/browser/dist/backend"; -import { BaseBackend, NoopTransport } from "@sentry/core"; -import { BrowserOptions, Transports } from "@sentry/react"; -import { Event, EventHint, Severity, Transport } from "@sentry/types"; +import { BrowserBackend } from '@sentry/browser/dist/backend'; +import { BaseBackend, NoopTransport } from '@sentry/core'; +import { BrowserOptions, Transports } from '@sentry/react'; +import { Event, EventHint, Severity, Transport } from '@sentry/types'; // @ts-ignore LogBox introduced in RN 0.63 -import { Alert, LogBox, YellowBox } from "react-native"; +import { Alert, LogBox, YellowBox } from 'react-native'; -import { ReactNativeOptions } from "./options"; -import { NativeTransport } from "./transports/native"; -import { NATIVE } from "./wrapper"; +import { ReactNativeOptions } from './options'; +import { NativeTransport } from './transports/native'; +import { NATIVE } from './wrapper'; /** The Sentry ReactNative SDK Backend. */ export class ReactNativeBackend extends BaseBackend { @@ -22,10 +22,10 @@ export class ReactNativeBackend extends BaseBackend { // YellowBox deprecated and replaced with with LogBox in RN 0.63 if (LogBox) { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - LogBox.ignoreLogs(["Require cycle:"]); + LogBox.ignoreLogs(['Require cycle:']); } else { // eslint-disable-next-line deprecation/deprecation - YellowBox.ignoreWarnings(["Require cycle:"]); + YellowBox.ignoreWarnings(['Require cycle:']); } void this._initNativeSdk(); @@ -110,8 +110,8 @@ export class ReactNativeBackend extends BaseBackend { private _showCannotConnectDialog(): void { if (__DEV__ && this._options.enableNativeNagger) { Alert.alert( - "Sentry", - "Warning, could not connect to Sentry native SDK.\nIf you do not want to use the native component please pass `enableNative: false` in the options.\nVisit: https://docs.sentry.io/platforms/react-native/#linking for more details." + 'Sentry', + 'Warning, could not connect to Sentry native SDK.\nIf you do not want to use the native component please pass `enableNative: false` in the options.\nVisit: https://docs.sentry.io/platforms/react-native/#linking for more details.' ); } } diff --git a/src/js/client.ts b/src/js/client.ts index 37dd3d3bb..ca23ae709 100644 --- a/src/js/client.ts +++ b/src/js/client.ts @@ -1,8 +1,8 @@ -import { BaseClient } from "@sentry/core"; +import { BaseClient } from '@sentry/core'; -import { ReactNativeBackend } from "./backend"; -import { ReactNativeOptions } from "./options"; -import { NATIVE } from "./wrapper"; +import { ReactNativeBackend } from './backend'; +import { ReactNativeOptions } from './options'; +import { NATIVE } from './wrapper'; /** * The Sentry React Native SDK Client. diff --git a/src/js/definitions.ts b/src/js/definitions.ts index 1146a31b4..69f97753c 100644 --- a/src/js/definitions.ts +++ b/src/js/definitions.ts @@ -1,6 +1,6 @@ -import { Breadcrumb, Package } from "@sentry/types"; +import { Breadcrumb, Package } from '@sentry/types'; -import { ReactNativeOptions } from "./options"; +import { ReactNativeOptions } from './options'; export type NativeAppStartResponse = { isColdStart: boolean; diff --git a/src/js/index.ts b/src/js/index.ts index bdfb5bc7c..d683d6d05 100644 --- a/src/js/index.ts +++ b/src/js/index.ts @@ -11,7 +11,7 @@ export { EventStatus, Thread, User, -} from "@sentry/types"; +} from '@sentry/types'; export { addGlobalEventProcessor, @@ -32,14 +32,14 @@ export { setUser, startTransaction, withScope, -} from "@sentry/core"; +} from '@sentry/core'; // We need to import it so we patch the hub with global functions // aka. this has side effects -import "@sentry/tracing"; +import '@sentry/tracing'; // Add the React Native SDK's own tracing extensions, this needs to happen AFTER @sentry/tracing's -import { _addTracingExtensions } from "./measurements"; +import { _addTracingExtensions } from './measurements'; _addTracingExtensions(); export { @@ -50,14 +50,14 @@ export { Profiler, useProfiler, withProfiler, -} from "@sentry/react"; +} from '@sentry/react'; -import * as Integrations from "./integrations"; -import { SDK_NAME, SDK_VERSION } from "./version"; +import * as Integrations from './integrations'; +import { SDK_NAME, SDK_VERSION } from './version'; -export { ReactNativeBackend } from "./backend"; -export { ReactNativeOptions } from "./options"; -export { ReactNativeClient } from "./client"; +export { ReactNativeBackend } from './backend'; +export { ReactNativeOptions } from './options'; +export { ReactNativeClient } from './client'; export { init, @@ -69,8 +69,8 @@ export { nativeCrash, flush, close, -} from "./sdk"; -export { TouchEventBoundary, withTouchEventBoundary } from "./touchevents"; +} from './sdk'; +export { TouchEventBoundary, withTouchEventBoundary } from './touchevents'; export { ReactNativeTracing, @@ -81,6 +81,6 @@ export { ReactNativeNavigationInstrumentation, RoutingInstrumentation, ReactNavigationTransactionContext, -} from "./tracing"; +} from './tracing'; export { Integrations, SDK_NAME, SDK_VERSION }; diff --git a/src/js/integrations/debugsymbolicator.ts b/src/js/integrations/debugsymbolicator.ts index 104117a9c..038ae6311 100644 --- a/src/js/integrations/debugsymbolicator.ts +++ b/src/js/integrations/debugsymbolicator.ts @@ -1,9 +1,9 @@ -import { addGlobalEventProcessor, getCurrentHub } from "@sentry/core"; -import { Event, EventHint, Integration, StackFrame } from "@sentry/types"; -import { addContextToFrame, logger } from "@sentry/utils"; +import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core'; +import { Event, EventHint, Integration, StackFrame } from '@sentry/types'; +import { addContextToFrame, logger } from '@sentry/utils'; const INTERNAL_CALLSITES_REGEX = new RegExp( - ["ReactNativeRenderer-dev\\.js$", "MessageQueue\\.js$"].join("|") + ['ReactNativeRenderer-dev\\.js$', 'MessageQueue\\.js$'].join('|') ); interface GetDevServer { @@ -36,7 +36,7 @@ export class DebugSymbolicator implements Integration { /** * @inheritDoc */ - public static id: string = "DebugSymbolicator"; + public static id: string = 'DebugSymbolicator'; /** * @inheritDoc */ @@ -56,7 +56,7 @@ export class DebugSymbolicator implements Integration { const reactError = hint.originalException as ReactNativeError; // eslint-disable-next-line @typescript-eslint/no-var-requires - const parseErrorStack = require("react-native/Libraries/Core/Devtools/parseErrorStack"); + const parseErrorStack = require('react-native/Libraries/Core/Devtools/parseErrorStack'); let stack; try { @@ -75,7 +75,7 @@ export class DebugSymbolicator implements Integration { await self._symbolicate(event, stack); - event.platform = "node"; // Setting platform node makes sure we do not show source maps errors + event.platform = 'node'; // Setting platform node makes sure we do not show source maps errors return event; }); @@ -91,7 +91,7 @@ export class DebugSymbolicator implements Integration { ): Promise { try { // eslint-disable-next-line @typescript-eslint/no-var-requires - const symbolicateStackTrace = require("react-native/Libraries/Core/Devtools/symbolicateStackTrace"); + const symbolicateStackTrace = require('react-native/Libraries/Core/Devtools/symbolicateStackTrace'); const prettyStack = await symbolicateStackTrace(stack); if (prettyStack) { @@ -114,7 +114,7 @@ export class DebugSymbolicator implements Integration { ); this._replaceFramesInEvent(event, symbolicatedFrames); } else { - logger.error("The stack is null"); + logger.error('The stack is null'); } } catch (error) { if (error instanceof Error) { @@ -132,7 +132,7 @@ export class DebugSymbolicator implements Integration { ): Promise { let getDevServer: GetDevServer; try { - getDevServer = require("react-native/Libraries/Core/Devtools/getDevServer"); + getDevServer = require('react-native/Libraries/Core/Devtools/getDevServer'); } catch (_oO) { // We can't load devserver URL } @@ -145,8 +145,8 @@ export class DebugSymbolicator implements Integration { inApp = inApp && frame.file !== undefined && - !frame.file.includes("node_modules") && - !frame.file.includes("native code"); + !frame.file.includes('node_modules') && + !frame.file.includes('native code'); const newFrame: StackFrame = { colno: frame.column, @@ -154,7 +154,7 @@ export class DebugSymbolicator implements Integration { function: frame.methodName, in_app: inApp, lineno: inApp ? frame.lineNumber : undefined, // :HACK - platform: inApp ? "javascript" : "node", // :HACK + platform: inApp ? 'javascript' : 'node', // :HACK }; // The upstream `react-native@0.61` delegates parsing of stacks to `stacktrace-parser`, which is buggy and @@ -162,7 +162,7 @@ export class DebugSymbolicator implements Integration { // `react-native@0.62` seems to have custom logic to parse hermes frames specially. // Anyway, all we do here is throw away the bogus suffix. if (newFrame.function) { - const addressAtPos = newFrame.function.indexOf("(address at"); + const addressAtPos = newFrame.function.indexOf('(address at'); if (addressAtPos >= 0) { newFrame.function = newFrame.function .substr(0, addressAtPos) @@ -208,15 +208,15 @@ export class DebugSymbolicator implements Integration { ): Promise { let response; - const segments = frame.filename?.split("/") ?? []; + const segments = frame.filename?.split('/') ?? []; if (getDevServer) { for (const idx in segments) { if (Object.prototype.hasOwnProperty.call(segments, idx)) { response = await fetch( - `${getDevServer().url}${segments.slice(-idx).join("/")}`, + `${getDevServer().url}${segments.slice(-idx).join('/')}`, { - method: "GET", + method: 'GET', } ); @@ -229,7 +229,7 @@ export class DebugSymbolicator implements Integration { if (response && response.ok) { const content = await response.text(); - const lines = content.split("\n"); + const lines = content.split('\n'); addContextToFrame(lines, frame); } diff --git a/src/js/integrations/devicecontext.ts b/src/js/integrations/devicecontext.ts index 86fd4bc12..00fc67864 100644 --- a/src/js/integrations/devicecontext.ts +++ b/src/js/integrations/devicecontext.ts @@ -1,15 +1,15 @@ -import { addGlobalEventProcessor, getCurrentHub } from "@sentry/core"; -import { Contexts, Event, Integration } from "@sentry/types"; -import { logger } from "@sentry/utils"; +import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core'; +import { Contexts, Event, Integration } from '@sentry/types'; +import { logger } from '@sentry/utils'; -import { NATIVE } from "../wrapper"; +import { NATIVE } from '../wrapper'; /** Load device context from native. */ export class DeviceContext implements Integration { /** * @inheritDoc */ - public static id: string = "DeviceContext"; + public static id: string = 'DeviceContext'; /** * @inheritDoc diff --git a/src/js/integrations/eventorigin.ts b/src/js/integrations/eventorigin.ts index 49bcbed8f..28b75d4e8 100644 --- a/src/js/integrations/eventorigin.ts +++ b/src/js/integrations/eventorigin.ts @@ -1,11 +1,11 @@ -import { EventProcessor, Integration } from "@sentry/types"; +import { EventProcessor, Integration } from '@sentry/types'; /** Default EventOrigin instrumentation */ export class EventOrigin implements Integration { /** * @inheritDoc */ - public static id: string = "EventOrigin"; + public static id: string = 'EventOrigin'; /** * @inheritDoc @@ -19,8 +19,8 @@ export class EventOrigin implements Integration { addGlobalEventProcessor((event) => { event.tags = event.tags ?? {}; - event.tags["event.origin"] = "javascript"; - event.tags["event.environment"] = "javascript"; + event.tags['event.origin'] = 'javascript'; + event.tags['event.environment'] = 'javascript'; return event; }); diff --git a/src/js/integrations/index.ts b/src/js/integrations/index.ts index ccb10b759..484b807b1 100644 --- a/src/js/integrations/index.ts +++ b/src/js/integrations/index.ts @@ -1,6 +1,6 @@ -export { DebugSymbolicator } from "./debugsymbolicator"; -export { DeviceContext } from "./devicecontext"; -export { ReactNativeErrorHandlers } from "./reactnativeerrorhandlers"; -export { Release } from "./release"; -export { EventOrigin } from "./eventorigin"; -export { SdkInfo } from "./sdkinfo"; +export { DebugSymbolicator } from './debugsymbolicator'; +export { DeviceContext } from './devicecontext'; +export { ReactNativeErrorHandlers } from './reactnativeerrorhandlers'; +export { Release } from './release'; +export { EventOrigin } from './eventorigin'; +export { SdkInfo } from './sdkinfo'; diff --git a/src/js/integrations/reactnativeerrorhandlers.ts b/src/js/integrations/reactnativeerrorhandlers.ts index 00e9b1204..00eb7ac6e 100644 --- a/src/js/integrations/reactnativeerrorhandlers.ts +++ b/src/js/integrations/reactnativeerrorhandlers.ts @@ -1,9 +1,9 @@ -import { eventFromException } from "@sentry/browser"; -import { getCurrentHub } from "@sentry/core"; -import { Integration, Severity } from "@sentry/types"; -import { addExceptionMechanism, getGlobalObject, logger } from "@sentry/utils"; +import { eventFromException } from '@sentry/browser'; +import { getCurrentHub } from '@sentry/core'; +import { Integration, Severity } from '@sentry/types'; +import { addExceptionMechanism, getGlobalObject, logger } from '@sentry/utils'; -import { ReactNativeClient } from "../client"; +import { ReactNativeClient } from '../client'; /** ReactNativeErrorHandlers Options */ interface ReactNativeErrorHandlersOptions { @@ -25,7 +25,7 @@ export class ReactNativeErrorHandlers implements Integration { /** * @inheritDoc */ - public static id: string = "ReactNativeErrorHandlers"; + public static id: string = 'ReactNativeErrorHandlers'; /** * @inheritDoc @@ -79,16 +79,16 @@ export class ReactNativeErrorHandlers implements Integration { /* eslint-disable import/no-extraneous-dependencies,@typescript-eslint/no-var-requires */ const { polyfillGlobal, - } = require("react-native/Libraries/Utilities/PolyfillFunctions"); + } = require('react-native/Libraries/Utilities/PolyfillFunctions'); // Below, we follow the exact way React Native initializes its promise library, and we globally replace it. - const Promise = require("promise/setimmediate/es6-extensions"); + const Promise = require('promise/setimmediate/es6-extensions'); // As of RN 0.67 only done and finally are used - require("promise/setimmediate/done"); - require("promise/setimmediate/finally"); + require('promise/setimmediate/done'); + require('promise/setimmediate/finally'); - polyfillGlobal("Promise", () => Promise); + polyfillGlobal('Promise', () => Promise); /* eslint-enable import/no-extraneous-dependencies,@typescript-eslint/no-var-requires */ } /** @@ -99,7 +99,7 @@ export class ReactNativeErrorHandlers implements Integration { disable: () => void; enable: (arg: unknown) => void; // eslint-disable-next-line import/no-extraneous-dependencies,@typescript-eslint/no-var-requires - } = require("promise/setimmediate/rejection-tracking"); + } = require('promise/setimmediate/rejection-tracking'); const promiseRejectionTrackingOptions: PromiseRejectionTrackingOptions = { onUnhandled: (id, rejection = {}) => { @@ -112,7 +112,7 @@ export class ReactNativeErrorHandlers implements Integration { // eslint-disable-next-line no-console console.warn( `Promise Rejection Handled (id: ${id})\n` + - "This means you can ignore any previous messages of the form " + + 'This means you can ignore any previous messages of the form ' + `"Possible Unhandled Promise Rejection (id: ${id}):"` ); }, @@ -141,21 +141,21 @@ export class ReactNativeErrorHandlers implements Integration { private _checkPromiseAndWarn(): void { try { // eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-extraneous-dependencies - const Promise = require("promise/setimmediate/es6-extensions"); + const Promise = require('promise/setimmediate/es6-extensions'); const _global = getGlobalObject<{ Promise: typeof Promise }>(); if (Promise !== _global.Promise) { logger.warn( - "Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page." + 'Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.' ); } else { - logger.log("Unhandled promise rejections will be caught by Sentry."); + logger.log('Unhandled promise rejections will be caught by Sentry.'); } } catch (e) { // Do Nothing logger.warn( - "Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page." + 'Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.' ); } } @@ -176,7 +176,7 @@ export class ReactNativeErrorHandlers implements Integration { if (shouldHandleFatal) { if (handlingFatal) { logger.log( - "Encountered multiple fatals in a row. The latest:", + 'Encountered multiple fatals in a row. The latest:', error ); return; @@ -189,7 +189,7 @@ export class ReactNativeErrorHandlers implements Integration { if (!client) { logger.error( - "Sentry client is missing, the error event might be lost.", + 'Sentry client is missing, the error event might be lost.', error ); @@ -201,16 +201,16 @@ export class ReactNativeErrorHandlers implements Integration { const options = client.getOptions(); - const event = await eventFromException(options, error, { + const event = await eventFromException(error, { originalException: error, - }); + }, options.attachStacktrace); if (isFatal) { event.level = Severity.Fatal; addExceptionMechanism(event, { handled: false, - type: "onerror", + type: 'onerror', }); } diff --git a/src/js/integrations/release.ts b/src/js/integrations/release.ts index eaf7c8bd3..338b27110 100644 --- a/src/js/integrations/release.ts +++ b/src/js/integrations/release.ts @@ -1,14 +1,14 @@ -import { addGlobalEventProcessor, getCurrentHub } from "@sentry/core"; -import { Event, Integration } from "@sentry/types"; +import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core'; +import { Event, Integration } from '@sentry/types'; -import { NATIVE } from "../wrapper"; +import { NATIVE } from '../wrapper'; /** Release integration responsible to load release from file. */ export class Release implements Integration { /** * @inheritDoc */ - public static id: string = "Release"; + public static id: string = 'Release'; /** * @inheritDoc */ @@ -30,15 +30,15 @@ export class Release implements Integration { __sentry_release and __sentry_dist is set by the user with setRelease and setDist. If this is used then this is the strongest. Otherwise we check for the release and dist in the options passed on init, as this is stronger than the release/dist from the native build. */ - if (typeof event.extra?.__sentry_release === "string") { + if (typeof event.extra?.__sentry_release === 'string') { event.release = `${event.extra.__sentry_release}`; - } else if (typeof options?.release === "string") { + } else if (typeof options?.release === 'string') { event.release = options.release; } - if (typeof event.extra?.__sentry_dist === "string") { + if (typeof event.extra?.__sentry_dist === 'string') { event.dist = `${event.extra.__sentry_dist}`; - } else if (typeof options?.dist === "string") { + } else if (typeof options?.dist === 'string') { event.dist = options.dist; } diff --git a/src/js/integrations/sdkinfo.ts b/src/js/integrations/sdkinfo.ts index 93372651e..83967fd10 100644 --- a/src/js/integrations/sdkinfo.ts +++ b/src/js/integrations/sdkinfo.ts @@ -1,15 +1,15 @@ -import { EventProcessor, Integration, Package } from "@sentry/types"; -import { logger } from "@sentry/utils"; +import { EventProcessor, Integration, Package } from '@sentry/types'; +import { logger } from '@sentry/utils'; -import { SDK_NAME, SDK_VERSION } from "../version"; -import { NATIVE } from "../wrapper"; +import { SDK_NAME, SDK_VERSION } from '../version'; +import { NATIVE } from '../wrapper'; /** Default SdkInfo instrumentation */ export class SdkInfo implements Integration { /** * @inheritDoc */ - public static id: string = "SdkInfo"; + public static id: string = 'SdkInfo'; /** * @inheritDoc @@ -25,19 +25,19 @@ export class SdkInfo implements Integration { addGlobalEventProcessor(async (event) => { // The native SDK info package here is only used on iOS as `beforeSend` is not called on `captureEnvelope`. // this._nativeSdkInfo should be defined a following time so this call won't always be awaited. - if (NATIVE.platform === "ios" && this._nativeSdkInfo === null) { + if (NATIVE.platform === 'ios' && this._nativeSdkInfo === null) { try { this._nativeSdkInfo = await NATIVE.fetchNativeSdkInfo(); } catch (e) { // If this fails, go ahead as usual as we would rather have the event be sent with a package missing. logger.warn( - "[SdkInfo] Native SDK Info retrieval failed...something could be wrong with your Sentry installation:" + '[SdkInfo] Native SDK Info retrieval failed...something could be wrong with your Sentry installation:' ); logger.warn(e); } } - event.platform = event.platform || "javascript"; + event.platform = event.platform || 'javascript'; event.sdk = { ...(event.sdk ?? {}), name: SDK_NAME, @@ -45,7 +45,7 @@ export class SdkInfo implements Integration { ...((event.sdk && event.sdk.packages) || []), ...((this._nativeSdkInfo && [this._nativeSdkInfo]) || []), { - name: "npm:@sentry/react-native", + name: 'npm:@sentry/react-native', version: SDK_VERSION, }, ], diff --git a/src/js/measurements.ts b/src/js/measurements.ts index 7cb64dc4c..cce764bf9 100644 --- a/src/js/measurements.ts +++ b/src/js/measurements.ts @@ -1,8 +1,8 @@ -import { getCurrentHub, getMainCarrier, Hub } from "@sentry/hub"; -import { Transaction } from "@sentry/tracing"; -import { CustomSamplingContext, TransactionContext } from "@sentry/types"; +import { getCurrentHub, getMainCarrier, Hub } from '@sentry/hub'; +import { Transaction } from '@sentry/tracing'; +import { CustomSamplingContext, TransactionContext } from '@sentry/types'; -import { ReactNativeTracing } from "./tracing"; +import { ReactNativeTracing } from './tracing'; /** * Adds React Native's extensions. Needs to be called after @sentry/tracing's extension methods are added diff --git a/src/js/options.ts b/src/js/options.ts index f8d3f9bbe..b8b19ad43 100644 --- a/src/js/options.ts +++ b/src/js/options.ts @@ -1,8 +1,8 @@ -import { BrowserOptions } from "@sentry/react"; -import { ProfilerProps } from "@sentry/react/dist/profiler"; -import { CaptureContext } from "@sentry/types/dist/scope"; +import { BrowserOptions } from '@sentry/react'; +import { ProfilerProps } from '@sentry/react/dist/profiler'; +import { CaptureContext } from '@sentry/types/dist/scope'; -import { TouchEventBoundaryProps } from "./touchevents"; +import { TouchEventBoundaryProps } from './touchevents'; /** * Configuration options for the Sentry ReactNative SDK. diff --git a/src/js/scope.ts b/src/js/scope.ts index eecab7e9c..162fb4555 100644 --- a/src/js/scope.ts +++ b/src/js/scope.ts @@ -1,7 +1,7 @@ -import { Scope } from "@sentry/hub"; -import { Breadcrumb, User } from "@sentry/types"; +import { Scope } from '@sentry/hub'; +import { Breadcrumb, User } from '@sentry/types'; -import { NATIVE } from "./wrapper"; +import { NATIVE } from './wrapper'; /** * Extends the scope methods to set scope on the Native SDKs diff --git a/src/js/sdk.tsx b/src/js/sdk.tsx index aaa947421..a44928399 100644 --- a/src/js/sdk.tsx +++ b/src/js/sdk.tsx @@ -1,12 +1,12 @@ -import { initAndBind, setExtra } from "@sentry/core"; -import { Hub, makeMain } from "@sentry/hub"; -import { RewriteFrames } from "@sentry/integrations"; -import { defaultIntegrations, getCurrentHub } from "@sentry/react"; -import { StackFrame } from "@sentry/types"; -import { getGlobalObject, logger } from "@sentry/utils"; -import * as React from "react"; - -import { ReactNativeClient } from "./client"; +import { initAndBind, setExtra } from '@sentry/core'; +import { Hub, makeMain } from '@sentry/hub'; +import { RewriteFrames } from '@sentry/integrations'; +import { defaultIntegrations, getCurrentHub } from '@sentry/react'; +import { StackFrame } from '@sentry/types'; +import { getGlobalObject, logger } from '@sentry/utils'; +import * as React from 'react'; + +import { ReactNativeClient } from './client'; import { DebugSymbolicator, DeviceContext, @@ -14,15 +14,15 @@ import { ReactNativeErrorHandlers, Release, SdkInfo, -} from "./integrations"; -import { ReactNativeOptions, ReactNativeWrapperOptions } from "./options"; -import { ReactNativeScope } from "./scope"; -import { TouchEventBoundary } from "./touchevents"; -import { ReactNativeProfiler, ReactNativeTracing } from "./tracing"; +} from './integrations'; +import { ReactNativeOptions, ReactNativeWrapperOptions } from './options'; +import { ReactNativeScope } from './scope'; +import { TouchEventBoundary } from './touchevents'; +import { ReactNativeProfiler, ReactNativeTracing } from './tracing'; const IGNORED_DEFAULT_INTEGRATIONS = [ - "GlobalHandlers", // We will use the react-native internal handlers - "TryCatch", // We don't need this + 'GlobalHandlers', // We will use the react-native internal handlers + 'TryCatch', // We don't need this ]; const DEFAULT_OPTIONS: ReactNativeOptions = { enableNative: true, @@ -48,8 +48,8 @@ export function init(passedOptions: ReactNativeOptions): void { // As long as tracing is opt in with either one of these options, then this is how we determine tracing is enabled. const tracingEnabled = - typeof options.tracesSampler !== "undefined" || - typeof options.tracesSampleRate !== "undefined"; + typeof options.tracesSampler !== 'undefined' || + typeof options.tracesSampleRate !== 'undefined'; if (options.defaultIntegrations === undefined) { options.defaultIntegrations = [ @@ -73,18 +73,18 @@ export function init(passedOptions: ReactNativeOptions): void { iteratee: (frame: StackFrame) => { if (frame.filename) { frame.filename = frame.filename - .replace(/^file:\/\//, "") - .replace(/^address at /, "") - .replace(/^.*\/[^.]+(\.app|CodePush|.*(?=\/))/, ""); + .replace(/^file:\/\//, '') + .replace(/^address at /, '') + .replace(/^.*\/[^.]+(\.app|CodePush|.*(?=\/))/, ''); if ( - frame.filename !== "[native code]" && - frame.filename !== "native" + frame.filename !== '[native code]' && + frame.filename !== 'native' ) { - const appPrefix = "app://"; + const appPrefix = 'app://'; // We always want to have a triple slash frame.filename = - frame.filename.indexOf("/") === 0 + frame.filename.indexOf('/') === 0 ? `${appPrefix}${frame.filename}` : `${appPrefix}/${frame.filename}`; } @@ -107,7 +107,7 @@ export function init(passedOptions: ReactNativeOptions): void { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-explicit-any if (getGlobalObject().HermesInternal) { - getCurrentHub().setTag("hermes", "true"); + getCurrentHub().setTag('hermes', 'true'); } } @@ -125,7 +125,7 @@ export function wrap

( const profilerProps = { ...(options?.profilerProps ?? {}), - name: RootComponent.displayName ?? "Root", + name: RootComponent.displayName ?? 'Root', }; const RootApp: React.FC

= (appProps) => { @@ -147,7 +147,7 @@ export function wrap

( * @deprecated */ export function setRelease(release: string): void { - setExtra("__sentry_release", release); + setExtra('__sentry_release', release); } /** @@ -156,7 +156,7 @@ export function setRelease(release: string): void { * @deprecated */ export function setDist(dist: string): void { - setExtra("__sentry_dist", dist); + setExtra('__sentry_dist', dist); } /** @@ -186,7 +186,7 @@ export async function flush(): Promise { // eslint-disable-next-line no-empty } catch (_) {} - logger.error("Failed to flush the event queue."); + logger.error('Failed to flush the event queue.'); return false; } @@ -202,6 +202,6 @@ export async function close(): Promise { await client.close(); } } catch (e) { - logger.error("Failed to close the SDK"); + logger.error('Failed to close the SDK'); } } diff --git a/src/js/touchevents.tsx b/src/js/touchevents.tsx index 0413e28e3..9ea3bfddd 100644 --- a/src/js/touchevents.tsx +++ b/src/js/touchevents.tsx @@ -1,8 +1,8 @@ -import { addBreadcrumb } from "@sentry/core"; -import { Severity } from "@sentry/types"; -import { logger } from "@sentry/utils"; -import * as React from "react"; -import { StyleSheet, View } from "react-native"; +import { addBreadcrumb } from '@sentry/core'; +import { Severity } from '@sentry/types'; +import { logger } from '@sentry/utils'; +import * as React from 'react'; +import { StyleSheet, View } from 'react-native'; export type TouchEventBoundaryProps = { /** @@ -35,11 +35,11 @@ const touchEventStyles = StyleSheet.create({ }, }); -const DEFAULT_BREADCRUMB_CATEGORY = "touch"; -const DEFAULT_BREADCRUMB_TYPE = "user"; +const DEFAULT_BREADCRUMB_CATEGORY = 'touch'; +const DEFAULT_BREADCRUMB_TYPE = 'user'; const DEFAULT_MAX_COMPONENT_TREE_SIZE = 20; -const PROP_KEY = "sentry-label"; +const PROP_KEY = 'sentry-label'; interface ElementInstance { elementType?: { @@ -54,7 +54,7 @@ interface ElementInstance { * Boundary to log breadcrumbs for interaction events. */ class TouchEventBoundary extends React.Component { - public static displayName: string = "__Sentry.TouchEventBoundary"; + public static displayName: string = '__Sentry.TouchEventBoundary'; public static defaultProps: Partial = { breadcrumbCategory: DEFAULT_BREADCRUMB_CATEGORY, breadcrumbType: DEFAULT_BREADCRUMB_TYPE, @@ -90,7 +90,7 @@ class TouchEventBoundary extends React.Component { level: Severity.Info, message: activeLabel ? `Touch event within element: ${activeLabel}` - : `Touch event within component tree`, + : 'Touch event within component tree', type: this.props.breadcrumbType, }; @@ -113,7 +113,7 @@ class TouchEventBoundary extends React.Component { return ignoreNames.some( (ignoreName: string | RegExp) => - (typeof ignoreName === "string" && name === ignoreName) || + (typeof ignoreName === 'string' && name === ignoreName) || (ignoreName instanceof RegExp && name.match(ignoreName)) ); } @@ -151,7 +151,7 @@ class TouchEventBoundary extends React.Component { const props = currentInst.memoizedProps; const label = - typeof props?.[PROP_KEY] !== "undefined" + typeof props?.[PROP_KEY] !== 'undefined' ? `${props[PROP_KEY]}` : undefined; @@ -162,7 +162,7 @@ class TouchEventBoundary extends React.Component { } componentTreeNames.push(label); } else if ( - typeof props?.accessibilityLabel === "string" && + typeof props?.accessibilityLabel === 'string' && !this._isNameIgnored(props.accessibilityLabel) ) { if (!activeLabel) { @@ -212,7 +212,7 @@ const withTouchEventBoundary = ( ); - WrappedComponent.displayName = "WithTouchEventBoundary"; + WrappedComponent.displayName = 'WithTouchEventBoundary'; return WrappedComponent; }; diff --git a/src/js/tracing/index.ts b/src/js/tracing/index.ts index 7ac562671..c660b54d7 100644 --- a/src/js/tracing/index.ts +++ b/src/js/tracing/index.ts @@ -1,22 +1,22 @@ -export { ReactNativeTracing } from "./reactnativetracing"; +export { ReactNativeTracing } from './reactnativetracing'; export { RoutingInstrumentation, RoutingInstrumentationInstance, -} from "./routingInstrumentation"; +} from './routingInstrumentation'; export { ReactNavigationInstrumentation, // eslint-disable-next-line deprecation/deprecation ReactNavigationV5Instrumentation, -} from "./reactnavigation"; -export { ReactNavigationV4Instrumentation } from "./reactnavigationv4"; -export { ReactNativeNavigationInstrumentation } from "./reactnativenavigation"; +} from './reactnavigation'; +export { ReactNavigationV4Instrumentation } from './reactnavigationv4'; +export { ReactNativeNavigationInstrumentation } from './reactnativenavigation'; export { ReactNavigationCurrentRoute, ReactNavigationRoute, ReactNavigationTransactionContext, -} from "./types"; +} from './types'; -export { ReactNativeProfiler } from "./reactnativeprofiler"; +export { ReactNativeProfiler } from './reactnativeprofiler'; diff --git a/src/js/tracing/nativeframes.ts b/src/js/tracing/nativeframes.ts index a992c5e02..b53ddc504 100644 --- a/src/js/tracing/nativeframes.ts +++ b/src/js/tracing/nativeframes.ts @@ -1,13 +1,13 @@ -import { Span, Transaction } from "@sentry/tracing"; -import { Event, EventProcessor } from "@sentry/types"; -import { logger, timestampInSeconds } from "@sentry/utils"; +import { Span, Transaction } from '@sentry/tracing'; +import { Event, EventProcessor } from '@sentry/types'; +import { logger, timestampInSeconds } from '@sentry/utils'; -import { NativeFramesResponse } from "../definitions"; -import { NATIVE } from "../wrapper"; -import { instrumentChildSpanFinish } from "./utils"; +import { NativeFramesResponse } from '../definitions'; +import { NATIVE } from '../wrapper'; +import { instrumentChildSpanFinish } from './utils'; type FramesMeasurements = Record< - "frames_total" | "frames_slow" | "frames_frozen", + 'frames_total' | 'frames_slow' | 'frames_frozen', { value: number } >; @@ -39,7 +39,7 @@ export class NativeFramesInstrumentation { doesExist: () => boolean ) { logger.log( - "[ReactNativeTracing] Native frames instrumentation initialized." + '[ReactNativeTracing] Native frames instrumentation initialized.' ); addGlobalEventProcessor((event) => this._processEvent(event, doesExist)); @@ -52,7 +52,7 @@ export class NativeFramesInstrumentation { public onTransactionStart(transaction: Transaction): void { void NATIVE.fetchNativeFrames().then((framesMetrics) => { if (framesMetrics) { - transaction.setData("__startFrames", framesMetrics); + transaction.setData('__startFrames', framesMetrics); } }); @@ -215,7 +215,7 @@ export class NativeFramesInstrumentation { } if ( - event.type === "transaction" && + event.type === 'transaction' && event.transaction && event.contexts && event.contexts.trace diff --git a/src/js/tracing/reactnativenavigation.ts b/src/js/tracing/reactnativenavigation.ts index 01f94e8ac..8d6be1b59 100644 --- a/src/js/tracing/reactnativenavigation.ts +++ b/src/js/tracing/reactnativenavigation.ts @@ -1,14 +1,14 @@ -import { Transaction as TransactionType } from "@sentry/types"; -import { logger } from "@sentry/utils"; -import { EmitterSubscription } from "react-native"; +import { Transaction as TransactionType } from '@sentry/types'; +import { logger } from '@sentry/utils'; +import { EmitterSubscription } from 'react-native'; import { InternalRoutingInstrumentation, OnConfirmRoute, TransactionCreator, -} from "./routingInstrumentation"; -import { BeforeNavigate, RouteChangeContextData } from "./types"; -import { getBlankTransactionContext } from "./utils"; +} from './routingInstrumentation'; +import { BeforeNavigate, RouteChangeContextData } from './types'; +import { getBlankTransactionContext } from './utils'; interface ReactNativeNavigationOptions { routeChangeTimeoutMs: number; @@ -23,10 +23,10 @@ interface ComponentEvent { } type ComponentType = - | "Component" - | "TopBarTitle" - | "TopBarBackground" - | "TopBarButton"; + | 'Component' + | 'TopBarTitle' + | 'TopBarBackground' + | 'TopBarButton'; export interface ComponentWillAppearEvent extends ComponentEvent { componentName: string; @@ -60,7 +60,7 @@ export interface NavigationDelegate { * - If `_onComponentWillAppear` isn't called within `options.routeChangeTimeoutMs` of the dispatch, then the transaction is not sampled and finished. */ export class ReactNativeNavigationInstrumentation extends InternalRoutingInstrumentation { - public static instrumentationName: string = "react-native-navigation"; + public static instrumentationName: string = 'react-native-navigation'; private _navigation: NavigationDelegate; private _options: ReactNativeNavigationOptions; @@ -166,7 +166,7 @@ export class ReactNativeNavigationInstrumentation extends InternalRoutingInstrum name: event.componentName, tags: { ...originalContext.tags, - "routing.route.name": event.componentName, + 'routing.route.name': event.componentName, }, data, }; @@ -216,7 +216,7 @@ export class ReactNativeNavigationInstrumentation extends InternalRoutingInstrum /** Cancels the latest transaction so it does not get sent to Sentry. */ private _clearStateChangeTimeout(): void { - if (typeof this._stateChangeTimeout !== "undefined") { + if (typeof this._stateChangeTimeout !== 'undefined') { clearTimeout(this._stateChangeTimeout); this._stateChangeTimeout = undefined; } diff --git a/src/js/tracing/reactnativeprofiler.tsx b/src/js/tracing/reactnativeprofiler.tsx index 018e43cc0..47edf5231 100644 --- a/src/js/tracing/reactnativeprofiler.tsx +++ b/src/js/tracing/reactnativeprofiler.tsx @@ -1,6 +1,6 @@ -import { getCurrentHub, Profiler } from "@sentry/react"; +import { getCurrentHub, Profiler } from '@sentry/react'; -import { ReactNativeTracing } from "./reactnativetracing"; +import { ReactNativeTracing } from './reactnativetracing'; /** * Custom profiler for the React Native app root. @@ -17,7 +17,7 @@ export class ReactNativeProfiler extends Profiler { ); if (this._mountSpan && tracingIntegration) { - if (typeof this._mountSpan.endTimestamp !== "undefined") { + if (typeof this._mountSpan.endTimestamp !== 'undefined') { // The first root component mount is the app start finish. tracingIntegration.onAppStartFinish(this._mountSpan.endTimestamp); } diff --git a/src/js/tracing/reactnativetracing.ts b/src/js/tracing/reactnativetracing.ts index e8ee4b596..64b0c0e8c 100644 --- a/src/js/tracing/reactnativetracing.ts +++ b/src/js/tracing/reactnativetracing.ts @@ -1,5 +1,5 @@ /* eslint-disable max-lines */ -import { Hub } from "@sentry/hub"; +import { Hub } from '@sentry/hub'; import { defaultRequestInstrumentationOptions, IdleTransaction, @@ -7,26 +7,26 @@ import { RequestInstrumentationOptions, startIdleTransaction, Transaction, -} from "@sentry/tracing"; +} from '@sentry/tracing'; import { EventProcessor, Integration, Transaction as TransactionType, TransactionContext, -} from "@sentry/types"; -import { logger } from "@sentry/utils"; - -import { NativeAppStartResponse } from "../definitions"; -import { RoutingInstrumentationInstance } from "../tracing/routingInstrumentation"; -import { NATIVE } from "../wrapper"; -import { NativeFramesInstrumentation } from "./nativeframes"; -import { StallTrackingInstrumentation } from "./stalltracking"; -import { BeforeNavigate, RouteChangeContextData } from "./types"; +} from '@sentry/types'; +import { logger } from '@sentry/utils'; + +import { NativeAppStartResponse } from '../definitions'; +import { RoutingInstrumentationInstance } from '../tracing/routingInstrumentation'; +import { NATIVE } from '../wrapper'; +import { NativeFramesInstrumentation } from './nativeframes'; +import { StallTrackingInstrumentation } from './stalltracking'; +import { BeforeNavigate, RouteChangeContextData } from './types'; import { adjustTransactionDuration, getTimeOriginMilliseconds, isNearToNow, -} from "./utils"; +} from './utils'; export interface ReactNativeTracingOptions extends RequestInstrumentationOptions { @@ -109,7 +109,7 @@ export class ReactNativeTracing implements Integration { /** * @inheritDoc */ - public static id: string = "ReactNativeTracing"; + public static id: string = 'ReactNativeTracing'; /** * @inheritDoc */ @@ -189,7 +189,7 @@ export class ReactNativeTracing implements Integration { ); } else { logger.log( - `[ReactNativeTracing] Not instrumenting route changes as routingInstrumentation has not been set.` + '[ReactNativeTracing] Not instrumenting route changes as routingInstrumentation has not been set.' ); } @@ -258,8 +258,8 @@ export class ReactNativeTracing implements Integration { const appStartTimeSeconds = appStart.appStartTime / 1000; const idleTransaction = this._createRouteTransaction({ - name: "App Start", - op: "ui.load", + name: 'App Start', + op: 'ui.load', startTimestamp: appStartTimeSeconds, }); @@ -277,15 +277,15 @@ export class ReactNativeTracing implements Integration { appStart: NativeAppStartResponse ): void { if (!this._appStartFinishTimestamp) { - logger.warn("App start was never finished."); + logger.warn('App start was never finished.'); return; } const appStartTimeSeconds = appStart.appStartTime / 1000; transaction.startChild({ - description: appStart.isColdStart ? "Cold App Start" : "Warm App Start", - op: appStart.isColdStart ? "app.start.cold" : "app.start.warm", + description: appStart.isColdStart ? 'Cold App Start' : 'Warm App Start', + op: appStart.isColdStart ? 'app.start.cold' : 'app.start.warm', startTimestamp: appStartTimeSeconds, endTimestamp: this._appStartFinishTimestamp, }); @@ -324,8 +324,8 @@ export class ReactNativeTracing implements Integration { const contextData = context.data as RouteChangeContextData; scope.addBreadcrumb({ - category: "navigation", - type: "navigation", + category: 'navigation', + type: 'navigation', // We assume that context.name is the name of the route. message: `Navigation to ${context.name}`, data: { @@ -335,7 +335,7 @@ export class ReactNativeTracing implements Integration { }); } - scope.setTag("routing.route.name", context.name); + scope.setTag('routing.route.name', context.name); }); } @@ -382,7 +382,7 @@ export class ReactNativeTracing implements Integration { if (this.options.enableAppStartTracking && this._awaitingAppStartData) { transaction.startTimestamp = this._awaitingAppStartData.appStartTime / 1000; - transaction.op = "ui.load"; + transaction.op = 'ui.load'; this._addAppStartData(transaction, this._awaitingAppStartData); @@ -411,7 +411,7 @@ export class ReactNativeTracing implements Integration { ).length === 0) ) { logger.log( - `[ReactNativeTracing] Not sampling transaction as route has been seen before. Pass ignoreEmptyBackNavigationTransactions = false to disable this feature.` + '[ReactNativeTracing] Not sampling transaction as route has been seen before. Pass ignoreEmptyBackNavigationTransactions = false to disable this feature.' ); // Route has been seen before and has no child spans. transaction.sampled = false; diff --git a/src/js/tracing/reactnavigation.ts b/src/js/tracing/reactnavigation.ts index 64ebcc843..816776450 100644 --- a/src/js/tracing/reactnavigation.ts +++ b/src/js/tracing/reactnavigation.ts @@ -1,18 +1,18 @@ /* eslint-disable max-lines */ -import { Transaction as TransactionType } from "@sentry/types"; -import { getGlobalObject, logger } from "@sentry/utils"; +import { Transaction as TransactionType } from '@sentry/types'; +import { getGlobalObject, logger } from '@sentry/utils'; import { InternalRoutingInstrumentation, OnConfirmRoute, TransactionCreator, -} from "./routingInstrumentation"; +} from './routingInstrumentation'; import { BeforeNavigate, ReactNavigationTransactionContext, RouteChangeContextData, -} from "./types"; -import { getBlankTransactionContext } from "./utils"; +} from './types'; +import { getBlankTransactionContext } from './utils'; export interface NavigationRoute { name: string; @@ -46,7 +46,7 @@ const defaultOptions: ReactNavigationOptions = { * - If `_onStateChange` isn't called within `STATE_CHANGE_TIMEOUT_DURATION` of the dispatch, then the transaction is not sampled and finished. */ export class ReactNavigationInstrumentation extends InternalRoutingInstrumentation { - public static instrumentationName: string = "react-navigation-v5"; + public static instrumentationName: string = 'react-navigation-v5'; private _navigationContainer: NavigationContainer | null = null; @@ -109,7 +109,7 @@ export class ReactNavigationInstrumentation extends InternalRoutingInstrumentati initialized in, it will initialize a new instance and will cause undefined behavior. */ if (!_global.__sentry_rn_v5_registered) { - if ("current" in navigationContainerRef) { + if ('current' in navigationContainerRef) { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access this._navigationContainer = navigationContainerRef.current; } else { @@ -118,11 +118,11 @@ export class ReactNavigationInstrumentation extends InternalRoutingInstrumentati if (this._navigationContainer) { this._navigationContainer.addListener( - "__unsafe_action__", // This action is emitted on every dispatch + '__unsafe_action__', // This action is emitted on every dispatch this._onDispatch.bind(this) ); this._navigationContainer.addListener( - "state", // This action is emitted on every state change + 'state', // This action is emitted on every state change this._onStateChange.bind(this) ); @@ -134,7 +134,7 @@ export class ReactNavigationInstrumentation extends InternalRoutingInstrumentati this._initialStateHandled = true; } else { logger.log( - "[ReactNavigationInstrumentation] Navigation container registered, but integration has not been setup yet." + '[ReactNavigationInstrumentation] Navigation container registered, but integration has not been setup yet.' ); } } @@ -142,12 +142,12 @@ export class ReactNavigationInstrumentation extends InternalRoutingInstrumentati _global.__sentry_rn_v5_registered = true; } else { logger.warn( - "[ReactNavigationInstrumentation] Received invalid navigation container ref!" + '[ReactNavigationInstrumentation] Received invalid navigation container ref!' ); } } else { logger.log( - "[ReactNavigationInstrumentation] Instrumentation already exists, but register has been called again, doing nothing." + '[ReactNavigationInstrumentation] Instrumentation already exists, but register has been called again, doing nothing.' ); } } @@ -160,7 +160,7 @@ export class ReactNavigationInstrumentation extends InternalRoutingInstrumentati private _onDispatch(): void { if (this._latestTransaction) { logger.log( - `[ReactNavigationInstrumentation] A transaction was detected that turned out to be a noop, discarding.` + '[ReactNavigationInstrumentation] A transaction was detected that turned out to be a noop, discarding.' ); this._discardLatestTransaction(); this._clearStateChangeTimeout(); @@ -187,7 +187,7 @@ export class ReactNavigationInstrumentation extends InternalRoutingInstrumentati if (!this._navigationContainer) { logger.warn( - "[ReactNavigationInstrumentation] Missing navigation container ref. Route transactions will not be sent." + '[ReactNavigationInstrumentation] Missing navigation container ref. Route transactions will not be sent.' ); return; @@ -223,7 +223,7 @@ export class ReactNavigationInstrumentation extends InternalRoutingInstrumentati name: route.name, tags: { ...originalContext.tags, - "routing.route.name": route.name, + 'routing.route.name': route.name, }, data, }; @@ -289,7 +289,7 @@ export class ReactNavigationInstrumentation extends InternalRoutingInstrumentati * */ private _clearStateChangeTimeout(): void { - if (typeof this._stateChangeTimeout !== "undefined") { + if (typeof this._stateChangeTimeout !== 'undefined') { clearTimeout(this._stateChangeTimeout); this._stateChangeTimeout = undefined; } @@ -303,10 +303,10 @@ export class ReactNavigationInstrumentation extends InternalRoutingInstrumentati export const ReactNavigationV5Instrumentation = ReactNavigationInstrumentation; export const BLANK_TRANSACTION_CONTEXT = { - name: "Route Change", - op: "navigation", + name: 'Route Change', + op: 'navigation', tags: { - "routing.instrumentation": + 'routing.instrumentation': ReactNavigationInstrumentation.instrumentationName, }, data: {}, diff --git a/src/js/tracing/reactnavigationv4.ts b/src/js/tracing/reactnavigationv4.ts index b43bed75d..755ae590a 100644 --- a/src/js/tracing/reactnavigationv4.ts +++ b/src/js/tracing/reactnavigationv4.ts @@ -1,17 +1,17 @@ /* eslint-disable max-lines */ -import { Transaction } from "@sentry/types"; -import { getGlobalObject, logger } from "@sentry/utils"; +import { Transaction } from '@sentry/types'; +import { getGlobalObject, logger } from '@sentry/utils'; import { InternalRoutingInstrumentation, OnConfirmRoute, TransactionCreator, -} from "./routingInstrumentation"; +} from './routingInstrumentation'; import { BeforeNavigate, ReactNavigationTransactionContext, RouteChangeContextData, -} from "./types"; +} from './types'; export interface NavigationRouteV4 { routeName: string; @@ -57,7 +57,7 @@ const defaultOptions: ReactNavigationV4Options = { * Register the app container with `registerAppContainer` to use, or see docs for more details. */ class ReactNavigationV4Instrumentation extends InternalRoutingInstrumentation { - public static instrumentationName: string = "react-navigation-v4"; + public static instrumentationName: string = 'react-navigation-v4'; private _appContainer: AppContainerInstance | null = null; @@ -127,7 +127,7 @@ class ReactNavigationV4Instrumentation extends InternalRoutingInstrumentation { initialized in, it will initialize a new instance and will cause undefined behavior. */ if (!_global.__sentry_rn_v4_registered) { - if ("current" in appContainerRef) { + if ('current' in appContainerRef) { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access this._appContainer = appContainerRef.current; } else { @@ -142,7 +142,7 @@ class ReactNavigationV4Instrumentation extends InternalRoutingInstrumentation { this._updateLatestTransaction(); } else { logger.log( - "[ReactNavigationV4Instrumentation] App container registered, but integration has not been setup yet." + '[ReactNavigationV4Instrumentation] App container registered, but integration has not been setup yet.' ); } this._initialStateHandled = true; @@ -151,7 +151,7 @@ class ReactNavigationV4Instrumentation extends InternalRoutingInstrumentation { _global.__sentry_rn_v4_registered = true; } else { logger.warn( - "[ReactNavigationV4Instrumentation] Received invalid app container ref!" + '[ReactNavigationV4Instrumentation] Received invalid app container ref!' ); } } @@ -165,7 +165,7 @@ class ReactNavigationV4Instrumentation extends InternalRoutingInstrumentation { if (this._appContainer && this._latestTransaction) { const state = this._appContainer._navigation.state; - if (typeof this._stateChangeTimeout !== "undefined") { + if (typeof this._stateChangeTimeout !== 'undefined') { clearTimeout(this._stateChangeTimeout); this._stateChangeTimeout = undefined; } @@ -207,7 +207,7 @@ class ReactNavigationV4Instrumentation extends InternalRoutingInstrumentation { // see: https://github.com/react-navigation/react-navigation/blob/45d419be93c34e900e8734ce98321ae875ac4997/packages/core/src/routers/SwitchRouter.js?rgh-link-date=2021-09-25T12%3A43%3A36Z#L301 if (!state || state === undefined) { logger.warn( - "[ReactNavigationV4Instrumentation] onStateChange called without a valid state." + '[ReactNavigationV4Instrumentation] onStateChange called without a valid state.' ); return; @@ -287,11 +287,11 @@ class ReactNavigationV4Instrumentation extends InternalRoutingInstrumentation { return { name: route.routeName, - op: "navigation", + op: 'navigation', tags: { - "routing.instrumentation": + 'routing.instrumentation': ReactNavigationV4Instrumentation.instrumentationName, - "routing.route.name": route.routeName, + 'routing.route.name': route.routeName, }, data, }; @@ -306,9 +306,9 @@ class ReactNavigationV4Instrumentation extends InternalRoutingInstrumentation { const parentRoute = state.routes[state.index]; if ( - "index" in parentRoute && - "routes" in parentRoute && - typeof parentRoute.index === "number" && + 'index' in parentRoute && + 'routes' in parentRoute && + typeof parentRoute.index === 'number' && Array.isArray(parentRoute.routes) ) { return this._getCurrentRouteFromState(parentRoute); @@ -346,10 +346,10 @@ class ReactNavigationV4Instrumentation extends InternalRoutingInstrumentation { } const INITIAL_TRANSACTION_CONTEXT_V4 = { - name: "App Launch", - op: "navigation", + name: 'App Launch', + op: 'navigation', tags: { - "routing.instrumentation": + 'routing.instrumentation': ReactNavigationV4Instrumentation.instrumentationName, }, data: {}, diff --git a/src/js/tracing/routingInstrumentation.ts b/src/js/tracing/routingInstrumentation.ts index fc7617075..57cf41561 100644 --- a/src/js/tracing/routingInstrumentation.ts +++ b/src/js/tracing/routingInstrumentation.ts @@ -1,7 +1,7 @@ -import { Hub } from "@sentry/hub"; -import { Transaction, TransactionContext } from "@sentry/types"; +import { Hub } from '@sentry/hub'; +import { Transaction, TransactionContext } from '@sentry/types'; -import { BeforeNavigate } from "./types"; +import { BeforeNavigate } from './types'; export type TransactionCreator = ( context: TransactionContext @@ -38,7 +38,7 @@ export interface RoutingInstrumentationInstance { * Pass this to the tracing integration, and call `onRouteWillChange` every time before a route changes. */ export class RoutingInstrumentation implements RoutingInstrumentationInstance { - public static instrumentationName: string = "base-routing-instrumentation"; + public static instrumentationName: string = 'base-routing-instrumentation'; protected _getCurrentHub?: () => Hub; protected _beforeNavigate?: BeforeNavigate; diff --git a/src/js/tracing/stalltracking.ts b/src/js/tracing/stalltracking.ts index 889a575ea..5b3cbafe3 100644 --- a/src/js/tracing/stalltracking.ts +++ b/src/js/tracing/stalltracking.ts @@ -1,7 +1,7 @@ /* eslint-disable max-lines */ -import { IdleTransaction, Span, Transaction } from "@sentry/tracing"; -import { Measurements } from "@sentry/types"; -import { logger, timestampInSeconds } from "@sentry/utils"; +import { IdleTransaction, Span, Transaction } from '@sentry/tracing'; +import { Measurements } from '@sentry/types'; +import { logger, timestampInSeconds } from '@sentry/utils'; export interface StallMeasurements extends Measurements { stall_count: { value: number }; @@ -78,7 +78,7 @@ export class StallTrackingInstrumentation { public onTransactionStart(transaction: Transaction): void { if (this._statsByTransaction.has(transaction)) { logger.error( - "[StallTracking] Tried to start stall tracking on a transaction already being tracked. Measurements might be lost." + '[StallTracking] Tried to start stall tracking on a transaction already being tracked. Measurements might be lost.' ); return; @@ -129,7 +129,7 @@ export class StallTrackingInstrumentation { if (!transactionStats) { // Transaction has been flushed out somehow, we return null. logger.log( - "[StallTracking] Stall measurements were not added to transaction due to exceeding the max count." + '[StallTracking] Stall measurements were not added to transaction due to exceeding the max count.' ); this._statsByTransaction.delete(transaction); @@ -155,7 +155,7 @@ export class StallTrackingInstrumentation { This is not safe in the case that something changes upstream, but if we're planning to move this over to @sentry/javascript anyways, we can have this temporarily for now. */ - const isIdleTransaction = "activities" in transaction; + const isIdleTransaction = 'activities' in transaction; let statsOnFinish: StallMeasurements | undefined; if (endTimestamp && isIdleTransaction) { @@ -198,13 +198,13 @@ export class StallTrackingInstrumentation { this._shouldStopTracking(); if (!statsOnFinish) { - if (typeof endTimestamp !== "undefined") { + if (typeof endTimestamp !== 'undefined') { logger.log( - "[StallTracking] Stall measurements not added due to `endTimestamp` being set." + '[StallTracking] Stall measurements not added due to `endTimestamp` being set.' ); } else if (trimEnd) { logger.log( - "[StallTracking] Stall measurements not added due to `trimEnd` being set but we could not determine the stall measurements at that time." + '[StallTracking] Stall measurements not added due to `trimEnd` being set but we could not determine the stall measurements at that time.' ); } @@ -242,7 +242,7 @@ export class StallTrackingInstrumentation { MARGIN_OF_ERROR_SECONDS ) { logger.log( - "[StallTracking] Span end not logged due to end timestamp being outside the margin of error from now." + '[StallTracking] Span end not logged due to end timestamp being outside the margin of error from now.' ); if ( diff --git a/src/js/tracing/types.ts b/src/js/tracing/types.ts index 46019ed2c..d6305ee72 100644 --- a/src/js/tracing/types.ts +++ b/src/js/tracing/types.ts @@ -1,4 +1,4 @@ -import { TransactionContext } from "@sentry/types"; +import { TransactionContext } from '@sentry/types'; export interface ReactNavigationRoute { name: string; @@ -25,8 +25,8 @@ export type RouteChangeContextData = { export interface ReactNavigationTransactionContext extends TransactionContext { tags: { - "routing.instrumentation": string; - "routing.route.name": string; + 'routing.instrumentation': string; + 'routing.route.name': string; }; data: RouteChangeContextData; } diff --git a/src/js/tracing/utils.ts b/src/js/tracing/utils.ts index d62607be9..ef933dc28 100644 --- a/src/js/tracing/utils.ts +++ b/src/js/tracing/utils.ts @@ -1,15 +1,15 @@ -import { IdleTransaction, Span, Transaction } from "@sentry/tracing"; -import { TransactionContext } from "@sentry/types"; -import { timestampInSeconds } from "@sentry/utils"; +import { IdleTransaction, Span, Transaction } from '@sentry/tracing'; +import { TransactionContext } from '@sentry/types'; +import { timestampInSeconds } from '@sentry/utils'; export const getBlankTransactionContext = ( name: string ): TransactionContext => { return { - name: "Route Change", - op: "navigation", + name: 'Route Change', + op: 'navigation', tags: { - "routing.instrumentation": name, + 'routing.instrumentation': name, }, data: {}, }; @@ -43,8 +43,8 @@ export function adjustTransactionDuration( const isOutdatedTransaction = endTimestamp && (diff > secToMs(maxDuration) || diff < 0); if (isOutdatedTransaction) { - transaction.setStatus("deadline_exceeded"); - transaction.setTag("maxTransactionDurationExceeded", "true"); + transaction.setStatus('deadline_exceeded'); + transaction.setTag('maxTransactionDurationExceeded', 'true'); } } diff --git a/src/js/transports/native.ts b/src/js/transports/native.ts index 7947169e8..36bf791e0 100644 --- a/src/js/transports/native.ts +++ b/src/js/transports/native.ts @@ -1,7 +1,7 @@ -import { Event, Response, Transport } from "@sentry/types"; -import { makePromiseBuffer, PromiseBuffer } from "@sentry/utils"; +import { Event, Response, Transport } from '@sentry/types'; +import { makePromiseBuffer, PromiseBuffer } from '@sentry/utils'; -import { NATIVE } from "../wrapper"; +import { NATIVE } from '../wrapper'; /** Native Transport class implementation */ export class NativeTransport implements Transport { diff --git a/src/js/version.ts b/src/js/version.ts index 157aa2a90..3a1b92c91 100644 --- a/src/js/version.ts +++ b/src/js/version.ts @@ -1,2 +1,2 @@ -export const SDK_NAME = "sentry.javascript.react-native"; -export const SDK_VERSION = "3.3.6"; +export const SDK_NAME = 'sentry.javascript.react-native'; +export const SDK_VERSION = '3.3.6'; diff --git a/src/js/wrapper.ts b/src/js/wrapper.ts index 051098f58..cbd9d2411 100644 --- a/src/js/wrapper.ts +++ b/src/js/wrapper.ts @@ -6,9 +6,9 @@ import { Response, Severity, User, -} from "@sentry/types"; -import { logger, SentryError } from "@sentry/utils"; -import { NativeModules, Platform } from "react-native"; +} from '@sentry/types'; +import { logger, SentryError } from '@sentry/utils'; +import { NativeModules, Platform } from 'react-native'; import { NativeAppStartResponse, @@ -16,8 +16,8 @@ import { NativeFramesResponse, NativeReleaseResponse, SentryNativeBridgeModule, -} from "./definitions"; -import { ReactNativeOptions } from "./options"; +} from './definitions'; +import { ReactNativeOptions } from './options'; const RNSentry = NativeModules.RNSentry as SentryNativeBridgeModule | undefined; @@ -72,8 +72,8 @@ export const NATIVE: SentryNativeWrapper = { async sendEvent(_event: Event): Promise { if (!this.enableNative) { return { - reason: `Event was skipped as native SDK is not enabled.`, - status: "skipped", + reason: 'Event was skipped as native SDK is not enabled.', + status: 'skipped', }; } @@ -92,7 +92,7 @@ export const NATIVE: SentryNativeWrapper = { }; let envelopeWasSent = false; - if (NATIVE.platform === "android") { + if (NATIVE.platform === 'android') { // Android const headerString = JSON.stringify(header); @@ -125,9 +125,9 @@ export const NATIVE: SentryNativeWrapper = { } const item = { - content_type: "application/json", + content_type: 'application/json', length, - type: payload.type ?? "event", + type: payload.type ?? 'event', }; const itemString = JSON.stringify(item); @@ -158,12 +158,12 @@ export const NATIVE: SentryNativeWrapper = { if (envelopeWasSent) { return { - status: "success", + status: 'success', }; } return { - status: "failed", + status: 'failed', }; }, @@ -180,7 +180,7 @@ export const NATIVE: SentryNativeWrapper = { if (!options.enableNative) { if (options.enableNativeNagger) { - logger.warn("Note: Native Sentry SDK is disabled."); + logger.warn('Note: Native Sentry SDK is disabled.'); } this.enableNative = false; return false; @@ -188,7 +188,7 @@ export const NATIVE: SentryNativeWrapper = { if (!options.autoInitializeNativeSdk) { if (options.enableNativeNagger) { logger.warn( - "Note: Native Sentry SDK was not initialized automatically, you will need to initialize it manually. If you wish to disable the native SDK and get rid of this warning, pass enableNative: false" + 'Note: Native Sentry SDK was not initialized automatically, you will need to initialize it manually. If you wish to disable the native SDK and get rid of this warning, pass enableNative: false' ); } return false; @@ -196,7 +196,7 @@ export const NATIVE: SentryNativeWrapper = { if (!options.dsn) { logger.warn( - "Warning: No DSN was provided. The Sentry SDK will be disabled. Native SDK will also not be initalized." + 'Warning: No DSN was provided. The Sentry SDK will be disabled. Native SDK will also not be initalized.' ); return false; } @@ -250,7 +250,7 @@ export const NATIVE: SentryNativeWrapper = { throw this._NativeClientError; } - if (this.platform !== "ios") { + if (this.platform !== 'ios') { return null; } @@ -268,7 +268,7 @@ export const NATIVE: SentryNativeWrapper = { throw this._NativeClientError; } - if (this.platform !== "ios") { + if (this.platform !== 'ios') { // Only ios uses deviceContexts, return an empty object. return {}; } @@ -356,7 +356,7 @@ export const NATIVE: SentryNativeWrapper = { } const stringifiedValue = - typeof value === "string" ? value : JSON.stringify(value); + typeof value === 'string' ? value : JSON.stringify(value); RNSentry.setTag(key, stringifiedValue); }, @@ -377,7 +377,7 @@ export const NATIVE: SentryNativeWrapper = { // we stringify the extra as native only takes in strings. const stringifiedExtra = - typeof extra === "string" ? extra : JSON.stringify(extra); + typeof extra === 'string' ? extra : JSON.stringify(extra); RNSentry.setExtra(key, stringifiedExtra); }, @@ -483,7 +483,7 @@ export const NATIVE: SentryNativeWrapper = { Object.keys(data).forEach((dataKey) => { const value = data[dataKey]; serialized[dataKey] = - typeof value === "string" ? value : JSON.stringify(value); + typeof value === 'string' ? value : JSON.stringify(value); }); return serialized; @@ -534,7 +534,7 @@ export const NATIVE: SentryNativeWrapper = { return !!module; }, - _DisabledNativeError: new SentryError("Native is disabled"), + _DisabledNativeError: new SentryError('Native is disabled'), _NativeClientError: new SentryError( "Native Client is not available, can't start on native." diff --git a/test/backend.test.ts b/test/backend.test.ts index 2bcfa203d..067817316 100644 --- a/test/backend.test.ts +++ b/test/backend.test.ts @@ -1,14 +1,14 @@ -import { NoopTransport } from "@sentry/core"; -import * as RN from "react-native"; +import { NoopTransport } from '@sentry/core'; +import * as RN from 'react-native'; -import { ReactNativeBackend } from "../src/js/backend"; -import { NATIVE } from "../src/js/wrapper"; +import { ReactNativeBackend } from '../src/js/backend'; +import { NATIVE } from '../src/js/wrapper'; const EXAMPLE_DSN = - "https://6890c2f6677340daa4804f8194804ea2@o19635.ingest.sentry.io/148053"; + 'https://6890c2f6677340daa4804f8194804ea2@o19635.ingest.sentry.io/148053'; jest.mock( - "react-native", + 'react-native', () => ({ NativeModules: { RNSentry: { @@ -17,7 +17,7 @@ jest.mock( }, }, Platform: { - OS: "mock", + OS: 'mock', }, LogBox: { ignoreLogs: jest.fn(), @@ -35,28 +35,28 @@ afterEach(() => { NATIVE.enableNative = true; }); -describe("Tests ReactNativeBackend", () => { - describe("initializing the backend", () => { - test("backend initializes", async () => { +describe('Tests ReactNativeBackend', () => { + describe('initializing the backend', () => { + test('backend initializes', async () => { const backend = new ReactNativeBackend({ dsn: EXAMPLE_DSN, enableNative: true, }); - await expect(backend.eventFromMessage("test")).resolves.toBeDefined(); + await expect(backend.eventFromMessage('test')).resolves.toBeDefined(); // @ts-ignore: Is Mocked // eslint-disable-next-line @typescript-eslint/unbound-method await expect(RN.LogBox.ignoreLogs).toBeCalled(); }); - test("invalid dsn is thrown", () => { + test('invalid dsn is thrown', () => { try { new ReactNativeBackend({ - dsn: "not a dsn", + dsn: 'not a dsn', enableNative: true, }); } catch (e: any) { - expect(e.message).toBe("Invalid Sentry Dsn: not a dsn"); + expect(e.message).toBe('Invalid Sentry Dsn: not a dsn'); } }); @@ -67,11 +67,11 @@ describe("Tests ReactNativeBackend", () => { enableNative: true, }); - return expect(backend.eventFromMessage("test")).resolves.toBeDefined(); + return expect(backend.eventFromMessage('test')).resolves.toBeDefined(); }).not.toThrow(); }); - test("falls back to YellowBox if no LogBox", async () => { + test('falls back to YellowBox if no LogBox', async () => { // @ts-ignore: Is Mocked RN.LogBox = undefined; @@ -80,14 +80,14 @@ describe("Tests ReactNativeBackend", () => { enableNative: true, }); - await expect(backend.eventFromMessage("test")).resolves.toBeDefined(); + await expect(backend.eventFromMessage('test')).resolves.toBeDefined(); // eslint-disable-next-line deprecation/deprecation await expect(RN.YellowBox.ignoreWarnings).toBeCalled(); }); }); - describe("onReady", () => { - test("calls onReady callback with true if Native SDK is initialized", (done) => { + describe('onReady', () => { + test('calls onReady callback with true if Native SDK is initialized', (done) => { new ReactNativeBackend({ dsn: EXAMPLE_DSN, enableNative: true, @@ -100,7 +100,7 @@ describe("Tests ReactNativeBackend", () => { }); }); - test("calls onReady callback with false if Native SDK was not initialized", (done) => { + test('calls onReady callback with false if Native SDK was not initialized', (done) => { new ReactNativeBackend({ dsn: EXAMPLE_DSN, enableNative: false, @@ -113,8 +113,8 @@ describe("Tests ReactNativeBackend", () => { }); }); - test("calls onReady callback with false if Native SDK failed to initialize", (done) => { - const RN = require("react-native"); + test('calls onReady callback with false if Native SDK failed to initialize', (done) => { + const RN = require('react-native'); RN.NativeModules.RNSentry.initNativeSdk = async () => { throw new Error(); @@ -133,9 +133,9 @@ describe("Tests ReactNativeBackend", () => { }); }); - describe("nativeCrash", () => { - test("calls NativeModules crash", () => { - const RN = require("react-native"); + describe('nativeCrash', () => { + test('calls NativeModules crash', () => { + const RN = require('react-native'); const backend = new ReactNativeBackend({ enableNative: true, diff --git a/test/integrations/eventorigin.test.ts b/test/integrations/eventorigin.test.ts index 83fbdab32..67628a9f1 100644 --- a/test/integrations/eventorigin.test.ts +++ b/test/integrations/eventorigin.test.ts @@ -1,9 +1,9 @@ -import { Event } from "@sentry/types"; +import { Event } from '@sentry/types'; -import { EventOrigin } from "../../src/js/integrations"; +import { EventOrigin } from '../../src/js/integrations'; -describe("Event Origin", () => { - it("Adds event.origin and event.environment javascript tags to events", (done) => { +describe('Event Origin', () => { + it('Adds event.origin and event.environment javascript tags to events', (done) => { const integration = new EventOrigin(); const mockEvent: Event = {}; @@ -16,8 +16,8 @@ describe("Event Origin", () => { if (processedEvent) { expect(processedEvent.tags).toBeDefined(); if (processedEvent.tags) { - expect(processedEvent.tags["event.origin"]).toBe("javascript"); - expect(processedEvent.tags["event.environment"]).toBe("javascript"); + expect(processedEvent.tags['event.origin']).toBe('javascript'); + expect(processedEvent.tags['event.environment']).toBe('javascript'); } } diff --git a/test/integrations/reactnativeerrorhandlers.test.ts b/test/integrations/reactnativeerrorhandlers.test.ts index 924e33465..bb460291a 100644 --- a/test/integrations/reactnativeerrorhandlers.test.ts +++ b/test/integrations/reactnativeerrorhandlers.test.ts @@ -1,5 +1,5 @@ -jest.mock("@sentry/core", () => { - const core = jest.requireActual("@sentry/core"); +jest.mock('@sentry/core', () => { + const core = jest.requireActual('@sentry/core'); const client = { getOptions: () => ({}), @@ -17,8 +17,8 @@ jest.mock("@sentry/core", () => { }; }); -jest.mock("@sentry/utils", () => { - const utils = jest.requireActual("@sentry/utils"); +jest.mock('@sentry/utils', () => { + const utils = jest.requireActual('@sentry/utils'); return { ...utils, logger: { @@ -29,10 +29,10 @@ jest.mock("@sentry/utils", () => { }; }); -import { getCurrentHub } from "@sentry/core"; -import { Severity } from "@sentry/types"; +import { getCurrentHub } from '@sentry/core'; +import { Severity } from '@sentry/types'; -import { ReactNativeErrorHandlers } from "../../src/js/integrations/reactnativeerrorhandlers"; +import { ReactNativeErrorHandlers } from '../../src/js/integrations/reactnativeerrorhandlers'; beforeEach(() => { ErrorUtils.getGlobalHandler = () => jest.fn(); @@ -42,9 +42,9 @@ afterEach(() => { jest.clearAllMocks(); }); -describe("ReactNativeErrorHandlers", () => { - describe("onError", () => { - test("Sets handled:false on a fatal error", async () => { +describe('ReactNativeErrorHandlers', () => { + describe('onError', () => { + test('Sets handled:false on a fatal error', async () => { // eslint-disable-next-line @typescript-eslint/no-empty-function let callback: (error: Error, isFatal: boolean) => Promise = () => Promise.resolve(); @@ -59,7 +59,7 @@ describe("ReactNativeErrorHandlers", () => { expect(ErrorUtils.setGlobalHandler).toHaveBeenCalledWith(callback); - await callback(new Error("Test Error"), true); + await callback(new Error('Test Error'), true); const hub = getCurrentHub(); // eslint-disable-next-line @typescript-eslint/unbound-method @@ -70,10 +70,10 @@ describe("ReactNativeErrorHandlers", () => { expect(event.level).toBe(Severity.Fatal); expect(event.exception?.values?.[0].mechanism?.handled).toBe(false); - expect(event.exception?.values?.[0].mechanism?.type).toBe("onerror"); + expect(event.exception?.values?.[0].mechanism?.type).toBe('onerror'); }); - test("Does not set handled:false on a non-fatal error", async () => { + test('Does not set handled:false on a non-fatal error', async () => { // eslint-disable-next-line @typescript-eslint/no-empty-function let callback: (error: Error, isFatal: boolean) => Promise = () => Promise.resolve(); @@ -88,7 +88,7 @@ describe("ReactNativeErrorHandlers", () => { expect(ErrorUtils.setGlobalHandler).toHaveBeenCalledWith(callback); - await callback(new Error("Test Error"), false); + await callback(new Error('Test Error'), false); const hub = getCurrentHub(); // eslint-disable-next-line @typescript-eslint/unbound-method @@ -99,7 +99,7 @@ describe("ReactNativeErrorHandlers", () => { expect(event.level).toBe(Severity.Error); expect(event.exception?.values?.[0].mechanism?.handled).toBe(true); - expect(event.exception?.values?.[0].mechanism?.type).toBe("generic"); + expect(event.exception?.values?.[0].mechanism?.type).toBe('generic'); }); }); }); diff --git a/test/integrations/release.test.ts b/test/integrations/release.test.ts index 775499fc2..44fe10d52 100644 --- a/test/integrations/release.test.ts +++ b/test/integrations/release.test.ts @@ -1,9 +1,9 @@ -import { addGlobalEventProcessor, getCurrentHub } from "@sentry/core"; -import { EventProcessor } from "@sentry/types"; +import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core'; +import { EventProcessor } from '@sentry/types'; -import { Release } from "../../src/js/integrations/release"; +import { Release } from '../../src/js/integrations/release'; -jest.mock("@sentry/core", () => { +jest.mock('@sentry/core', () => { const client = { getOptions: jest.fn(), }; @@ -19,18 +19,18 @@ jest.mock("@sentry/core", () => { }; }); -jest.mock("../../src/js/wrapper", () => ({ +jest.mock('../../src/js/wrapper', () => ({ NATIVE: { fetchNativeRelease: async () => ({ - build: "native_build", - id: "native_id", - version: "native_version", + build: 'native_build', + id: 'native_id', + version: 'native_version', }), }, })); -describe("Tests the Release integration", () => { - test("Uses release from native SDK if release/dist are not present in options.", async () => { +describe('Tests the Release integration', () => { + test('Uses release from native SDK if release/dist are not present in options.', async () => { const releaseIntegration = new Release(); let eventProcessor: EventProcessor = () => null; @@ -48,11 +48,11 @@ describe("Tests the Release integration", () => { const event = await eventProcessor({}); - expect(event?.release).toBe(`native_id@native_version+native_build`); - expect(event?.dist).toBe("native_build"); + expect(event?.release).toBe('native_id@native_version+native_build'); + expect(event?.dist).toBe('native_build'); }); - test("Uses release from native SDK if release is not present in options.", async () => { + test('Uses release from native SDK if release is not present in options.', async () => { const releaseIntegration = new Release(); let eventProcessor: EventProcessor = () => null; @@ -65,16 +65,16 @@ describe("Tests the Release integration", () => { // @ts-ignore Mock client.getOptions.mockImplementation(() => ({ - dist: "options_dist", + dist: 'options_dist', })); const event = await eventProcessor({}); - expect(event?.release).toBe(`native_id@native_version+native_build`); - expect(event?.dist).toBe("options_dist"); + expect(event?.release).toBe('native_id@native_version+native_build'); + expect(event?.dist).toBe('options_dist'); }); - test("Uses dist from native SDK if dist is not present in options.", async () => { + test('Uses dist from native SDK if dist is not present in options.', async () => { const releaseIntegration = new Release(); let eventProcessor: EventProcessor = () => null; @@ -87,16 +87,16 @@ describe("Tests the Release integration", () => { // @ts-ignore Mock client.getOptions.mockImplementation(() => ({ - release: "options_release", + release: 'options_release', })); const event = await eventProcessor({}); - expect(event?.release).toBe(`options_release`); - expect(event?.dist).toBe("native_build"); + expect(event?.release).toBe('options_release'); + expect(event?.dist).toBe('native_build'); }); - test("Uses release and dist from options", async () => { + test('Uses release and dist from options', async () => { const releaseIntegration = new Release(); let eventProcessor: EventProcessor = () => null; @@ -111,17 +111,17 @@ describe("Tests the Release integration", () => { // @ts-ignore Mock client.getOptions.mockImplementation(() => ({ - dist: "options_dist", - release: "options_release", + dist: 'options_dist', + release: 'options_release', })); const event = await eventProcessor({}); - expect(event?.release).toBe("options_release"); - expect(event?.dist).toBe("options_dist"); + expect(event?.release).toBe('options_release'); + expect(event?.dist).toBe('options_dist'); }); - test("Uses __sentry_release and __sentry_dist over everything else.", async () => { + test('Uses __sentry_release and __sentry_dist over everything else.', async () => { const releaseIntegration = new Release(); let eventProcessor: EventProcessor = () => null; @@ -136,18 +136,18 @@ describe("Tests the Release integration", () => { // @ts-ignore Mock client.getOptions.mockImplementation(() => ({ - dist: "options_dist", - release: "options_release", + dist: 'options_dist', + release: 'options_release', })); const event = await eventProcessor({ extra: { - __sentry_dist: "sentry_dist", - __sentry_release: "sentry_release", + __sentry_dist: 'sentry_dist', + __sentry_release: 'sentry_release', }, }); - expect(event?.release).toBe("sentry_release"); - expect(event?.dist).toBe("sentry_dist"); + expect(event?.release).toBe('sentry_release'); + expect(event?.dist).toBe('sentry_dist'); }); }); diff --git a/test/integrations/sdkinfo.test.ts b/test/integrations/sdkinfo.test.ts index cf03870ba..4a4ba347b 100644 --- a/test/integrations/sdkinfo.test.ts +++ b/test/integrations/sdkinfo.test.ts @@ -1,31 +1,31 @@ -import { Event } from "@sentry/types"; +import { Event } from '@sentry/types'; -import { SdkInfo } from "../../src/js/integrations"; -import { NATIVE } from "../../src/js/wrapper"; +import { SdkInfo } from '../../src/js/integrations'; +import { NATIVE } from '../../src/js/wrapper'; const mockPackage = { - name: "sentry-cocoa", - version: "0.0.1", + name: 'sentry-cocoa', + version: '0.0.1', }; -jest.mock("../../src/js/wrapper", () => { - const actual = jest.requireActual("../../src/js/wrapper"); +jest.mock('../../src/js/wrapper', () => { + const actual = jest.requireActual('../../src/js/wrapper'); return { NATIVE: { ...actual.NATIVE, - platform: "ios", + platform: 'ios', fetchNativeSdkInfo: jest.fn(() => Promise.resolve(mockPackage)), }, }; }); afterEach(() => { - NATIVE.platform = "ios"; + NATIVE.platform = 'ios'; }); -describe("Sdk Info", () => { - it("Adds native package and javascript platform to event on iOS", (done) => { +describe('Sdk Info', () => { + it('Adds native package and javascript platform to event on iOS', (done) => { const integration = new SdkInfo(); const mockEvent: Event = {}; @@ -49,7 +49,7 @@ describe("Sdk Info", () => { ).toBe(true); } } - expect(processedEvent.platform === "javascript"); + expect(processedEvent.platform === 'javascript'); } done(); @@ -59,8 +59,8 @@ describe("Sdk Info", () => { }); }); - it("Adds javascript platform but not native package on Android", (done) => { - NATIVE.platform = "android"; + it('Adds javascript platform but not native package on Android', (done) => { + NATIVE.platform = 'android'; const integration = new SdkInfo(); const mockEvent: Event = {}; @@ -84,7 +84,7 @@ describe("Sdk Info", () => { ).toBe(false); } } - expect(processedEvent.platform === "javascript"); + expect(processedEvent.platform === 'javascript'); } done(); diff --git a/test/sdk.test.ts b/test/sdk.test.ts index 94e438184..9d5b2e73a 100644 --- a/test/sdk.test.ts +++ b/test/sdk.test.ts @@ -1,7 +1,7 @@ -import { logger } from "@sentry/utils"; +import { logger } from '@sentry/utils'; -jest.mock("@sentry/react", () => { - const actualModule = jest.requireActual("@sentry/react"); +jest.mock('@sentry/react', () => { + const actualModule = jest.requireActual('@sentry/react'); const mockClient = { flush: jest.fn(() => Promise.resolve(true)), @@ -17,49 +17,49 @@ jest.mock("@sentry/react", () => { }; }); -jest.mock("@sentry/core", () => { - const originalCore = jest.requireActual("@sentry/core"); +jest.mock('@sentry/core', () => { + const originalCore = jest.requireActual('@sentry/core'); return { ...originalCore, initAndBind: jest.fn(), }; }); -jest.mock("@sentry/hub", () => { - const originalHub = jest.requireActual("@sentry/hub"); +jest.mock('@sentry/hub', () => { + const originalHub = jest.requireActual('@sentry/hub'); return { ...originalHub, makeMain: jest.fn(), }; }); -jest.mock("../src/js/scope", () => { +jest.mock('../src/js/scope', () => { return { ReactNativeScope: class ReactNativeScopeMock {}, }; }); -jest.mock("../src/js/client", () => { +jest.mock('../src/js/client', () => { return { ReactNativeClient: class ReactNativeClientMock {}, }; }); -jest.spyOn(logger, "error"); +jest.spyOn(logger, 'error'); -import { initAndBind } from "@sentry/core"; -import { getCurrentHub } from "@sentry/react"; +import { initAndBind } from '@sentry/core'; +import { getCurrentHub } from '@sentry/react'; -import { flush, init } from "../src/js/sdk"; -import { ReactNativeTracing } from "../src/js/tracing"; +import { flush, init } from '../src/js/sdk'; +import { ReactNativeTracing } from '../src/js/tracing'; afterEach(() => { jest.clearAllMocks(); }); -describe("Tests the SDK functionality", () => { - describe("init", () => { - describe("enableAutoPerformanceTracking", () => { +describe('Tests the SDK functionality', () => { + describe('init', () => { + describe('enableAutoPerformanceTracking', () => { const autoPerformanceIsEnabled = (): boolean => { const mockCall = (initAndBind as jest.MockedFunction< typeof initAndBind @@ -78,7 +78,7 @@ describe("Tests the SDK functionality", () => { return false; }; - it("Auto Performance is enabled when tracing is enabled (tracesSampler)", () => { + it('Auto Performance is enabled when tracing is enabled (tracesSampler)', () => { init({ tracesSampler: () => true, enableAutoPerformanceTracking: true, @@ -87,7 +87,7 @@ describe("Tests the SDK functionality", () => { expect(autoPerformanceIsEnabled()).toBe(true); }); - it("Auto Performance is enabled when tracing is enabled (tracesSampleRate)", () => { + it('Auto Performance is enabled when tracing is enabled (tracesSampleRate)', () => { init({ tracesSampleRate: 0.5, enableAutoPerformanceTracking: true, @@ -97,8 +97,8 @@ describe("Tests the SDK functionality", () => { }); }); - describe("flush", () => { - it("Calls flush on the client", async () => { + describe('flush', () => { + it('Calls flush on the client', async () => { const mockClient = getCurrentHub().getClient(); expect(mockClient).toBeTruthy(); @@ -112,7 +112,7 @@ describe("Tests the SDK functionality", () => { } }); - it("Returns false if flush failed and logs error", async () => { + it('Returns false if flush failed and logs error', async () => { const mockClient = getCurrentHub().getClient(); expect(mockClient).toBeTruthy(); @@ -126,7 +126,7 @@ describe("Tests the SDK functionality", () => { expect(flushResult).toBe(false); // eslint-disable-next-line @typescript-eslint/unbound-method expect(logger.error).toBeCalledWith( - "Failed to flush the event queue." + 'Failed to flush the event queue.' ); } }); diff --git a/test/testutils.ts b/test/testutils.ts index fd7b246c3..80f04e983 100644 --- a/test/testutils.ts +++ b/test/testutils.ts @@ -1,6 +1,6 @@ -import { Transaction } from "@sentry/tracing"; +import { Transaction } from '@sentry/tracing'; -import { getBlankTransactionContext } from "../src/js/tracing/utils"; +import { getBlankTransactionContext } from '../src/js/tracing/utils'; // eslint-disable-next-line @typescript-eslint/no-explicit-any export function mockFunction any>( diff --git a/test/touchevents.test.tsx b/test/touchevents.test.tsx index db3f0e943..07a75d95c 100644 --- a/test/touchevents.test.tsx +++ b/test/touchevents.test.tsx @@ -1,35 +1,35 @@ -import * as core from "@sentry/core"; -import { Severity } from "@sentry/types"; +import * as core from '@sentry/core'; +import { Severity } from '@sentry/types'; -import { TouchEventBoundary } from "../src/js/touchevents"; +import { TouchEventBoundary } from '../src/js/touchevents'; -const addBreadcrumb = jest.spyOn(core, "addBreadcrumb"); +const addBreadcrumb = jest.spyOn(core, 'addBreadcrumb'); afterEach(() => { jest.resetAllMocks(); }); -describe("TouchEventBoundary._onTouchStart", () => { - it("tree without displayName or label is not logged", () => { +describe('TouchEventBoundary._onTouchStart', () => { + it('tree without displayName or label is not logged', () => { const { defaultProps } = TouchEventBoundary; const boundary = new TouchEventBoundary(defaultProps); const event = { _targetInst: { elementType: { - name: "View", + name: 'View', }, return: { elementType: { - name: "Text", + name: 'Text', }, return: { elementType: { - name: "CoolComponent", + name: 'CoolComponent', }, return: { elementType: { - name: "Screen", + name: 'Screen', }, }, }, @@ -43,27 +43,27 @@ describe("TouchEventBoundary._onTouchStart", () => { expect(addBreadcrumb).not.toBeCalled(); }); - it("label is preferred over accessibilityLabel and displayName", () => { + it('label is preferred over accessibilityLabel and displayName', () => { const { defaultProps } = TouchEventBoundary; const boundary = new TouchEventBoundary(defaultProps); const event = { _targetInst: { elementType: { - displayName: "View", + displayName: 'View', }, return: { elementType: { - name: "Text", + name: 'Text', }, return: { elementType: { - displayName: "Connect(View)", + displayName: 'Connect(View)', }, return: { memoizedProps: { - "sentry-label": "LABEL!", - accessibilityLabel: "access!", + 'sentry-label': 'LABEL!', + accessibilityLabel: 'access!', }, }, }, @@ -77,49 +77,49 @@ describe("TouchEventBoundary._onTouchStart", () => { expect(addBreadcrumb).toBeCalledWith({ category: defaultProps.breadcrumbCategory, data: { - componentTree: ["View", "Connect(View)", "LABEL!"], + componentTree: ['View', 'Connect(View)', 'LABEL!'], }, level: Severity.Info, - message: "Touch event within element: LABEL!", + message: 'Touch event within element: LABEL!', type: defaultProps.breadcrumbType, }); }); - it("ignoreNames", () => { + it('ignoreNames', () => { const { defaultProps } = TouchEventBoundary; const boundary = new TouchEventBoundary({ ...defaultProps, - ignoreNames: ["View", "Ignore", /^Connect\(/, new RegExp("^Happy\\(")], + ignoreNames: ['View', 'Ignore', /^Connect\(/, new RegExp('^Happy\\(')], }); const event = { _targetInst: { elementType: { - name: "View", + name: 'View', }, return: { elementType: { - name: "Text", + name: 'Text', }, return: { elementType: { - displayName: "Connect(View)", + displayName: 'Connect(View)', }, return: { memoizedProps: { - "sentry-label": "Ignore", - accessibilityLabel: "Ignore", + 'sentry-label': 'Ignore', + accessibilityLabel: 'Ignore', }, elementType: { - displayName: "Styled(View2)", + displayName: 'Styled(View2)', }, return: { elementType: { - displayName: "Styled(View)", + displayName: 'Styled(View)', }, return: { elementType: { - displayName: "Happy(View)", + displayName: 'Happy(View)', }, }, }, @@ -135,15 +135,15 @@ describe("TouchEventBoundary._onTouchStart", () => { expect(addBreadcrumb).toBeCalledWith({ category: defaultProps.breadcrumbCategory, data: { - componentTree: ["Styled(View2)", "Styled(View)"], + componentTree: ['Styled(View2)', 'Styled(View)'], }, level: Severity.Info, - message: "Touch event within element: Styled(View2)", + message: 'Touch event within element: Styled(View2)', type: defaultProps.breadcrumbType, }); }); - it("maxComponentTreeSize", () => { + it('maxComponentTreeSize', () => { const { defaultProps } = TouchEventBoundary; const boundary = new TouchEventBoundary({ ...defaultProps, @@ -153,23 +153,23 @@ describe("TouchEventBoundary._onTouchStart", () => { const event = { _targetInst: { elementType: { - name: "View", + name: 'View', }, return: { elementType: { - name: "Text", + name: 'Text', }, return: { memoizedProps: { - accessibilityLabel: "Connect(View)", + accessibilityLabel: 'Connect(View)', }, return: { elementType: { - displayName: "Styled(View)", + displayName: 'Styled(View)', }, return: { elementType: { - displayName: "Happy(View)", + displayName: 'Happy(View)', }, }, }, @@ -184,10 +184,10 @@ describe("TouchEventBoundary._onTouchStart", () => { expect(addBreadcrumb).toBeCalledWith({ category: defaultProps.breadcrumbCategory, data: { - componentTree: ["Connect(View)", "Styled(View)"], + componentTree: ['Connect(View)', 'Styled(View)'], }, level: Severity.Info, - message: "Touch event within element: Connect(View)", + message: 'Touch event within element: Connect(View)', type: defaultProps.breadcrumbType, }); }); diff --git a/test/tracing/nativeframes.test.ts b/test/tracing/nativeframes.test.ts index a5a685c29..00159af5c 100644 --- a/test/tracing/nativeframes.test.ts +++ b/test/tracing/nativeframes.test.ts @@ -1,4 +1,4 @@ -jest.mock("../../src/js/wrapper", () => { +jest.mock('../../src/js/wrapper', () => { return { NATIVE: { fetchNativeFrames: jest.fn(), @@ -8,19 +8,19 @@ jest.mock("../../src/js/wrapper", () => { }; }); -import { Transaction } from "@sentry/tracing"; -import { EventProcessor } from "@sentry/types"; +import { Transaction } from '@sentry/tracing'; +import { EventProcessor } from '@sentry/types'; -import { NativeFramesInstrumentation } from "../../src/js/tracing/nativeframes"; -import { NATIVE } from "../../src/js/wrapper"; -import { mockFunction } from "../testutils"; +import { NativeFramesInstrumentation } from '../../src/js/tracing/nativeframes'; +import { NATIVE } from '../../src/js/wrapper'; +import { mockFunction } from '../testutils'; beforeEach(() => { jest.useFakeTimers(); }); -describe("NativeFramesInstrumentation", () => { - it("Sets start frames to trace context on transaction start.", (done) => { +describe('NativeFramesInstrumentation', () => { + it('Sets start frames to trace context on transaction start.', (done) => { const startFrames = { totalFrames: 100, slowFrames: 20, @@ -35,7 +35,7 @@ describe("NativeFramesInstrumentation", () => { () => true ); - const transaction = new Transaction({ name: "test" }); + const transaction = new Transaction({ name: 'test' }); instance.onTransactionStart(transaction); @@ -50,7 +50,7 @@ describe("NativeFramesInstrumentation", () => { }); }); - it("Sets measurements on the transaction event and removes startFrames from trace context.", (done) => { + it('Sets measurements on the transaction event and removes startFrames from trace context.', (done) => { const startFrames = { totalFrames: 100, slowFrames: 20, @@ -73,7 +73,7 @@ describe("NativeFramesInstrumentation", () => { () => true ); - const transaction = new Transaction({ name: "test" }); + const transaction = new Transaction({ name: 'test' }); instance.onTransactionStart(transaction); @@ -89,8 +89,8 @@ describe("NativeFramesInstrumentation", () => { expect(eventProcessor).toBeDefined(); if (eventProcessor) { const event = await eventProcessor({ - event_id: "0", - type: "transaction", + event_id: '0', + type: 'transaction', transaction: transaction.name, contexts: { trace: transaction.getTraceContext(), @@ -138,7 +138,7 @@ describe("NativeFramesInstrumentation", () => { }); }); - it("Does not set measurements on transactions without startFrames.", (done) => { + it('Does not set measurements on transactions without startFrames.', (done) => { const finishFrames = { totalFrames: 200, slowFrames: 40, @@ -156,9 +156,9 @@ describe("NativeFramesInstrumentation", () => { () => true ); - const transaction = new Transaction({ name: "test" }); + const transaction = new Transaction({ name: 'test' }); - transaction.setData("test", {}); + transaction.setData('test', {}); setImmediate(() => { const finishTimestamp = Date.now() / 1000; @@ -168,8 +168,8 @@ describe("NativeFramesInstrumentation", () => { expect(eventProcessor).toBeDefined(); if (eventProcessor) { const event = await eventProcessor({ - event_id: "0", - type: "transaction", + event_id: '0', + type: 'transaction', transaction: transaction.name, contexts: { trace: transaction.getTraceContext(), @@ -211,7 +211,7 @@ describe("NativeFramesInstrumentation", () => { }); }); - it("Sets measurements on the transaction event and removes startFrames if finishFrames is null.", (done) => { + it('Sets measurements on the transaction event and removes startFrames if finishFrames is null.', (done) => { const startFrames = { totalFrames: 100, slowFrames: 20, @@ -230,7 +230,7 @@ describe("NativeFramesInstrumentation", () => { () => true ); - const transaction = new Transaction({ name: "test" }); + const transaction = new Transaction({ name: 'test' }); instance.onTransactionStart(transaction); @@ -246,8 +246,8 @@ describe("NativeFramesInstrumentation", () => { expect(eventProcessor).toBeDefined(); if (eventProcessor) { const event = await eventProcessor({ - event_id: "0", - type: "transaction", + event_id: '0', + type: 'transaction', transaction: transaction.name, contexts: { trace: transaction.getTraceContext(), @@ -282,7 +282,7 @@ describe("NativeFramesInstrumentation", () => { }); }); - it("Does not set measurements on the transaction event and removes startFrames if finishFrames times out.", (done) => { + it('Does not set measurements on the transaction event and removes startFrames if finishFrames times out.', (done) => { jest.useRealTimers(); const startFrames = { @@ -302,7 +302,7 @@ describe("NativeFramesInstrumentation", () => { () => true ); - const transaction = new Transaction({ name: "test" }); + const transaction = new Transaction({ name: 'test' }); instance.onTransactionStart(transaction); @@ -321,8 +321,8 @@ describe("NativeFramesInstrumentation", () => { expect(eventProcessor).toBeDefined(); if (eventProcessor) { const event = await eventProcessor({ - event_id: "0", - type: "transaction", + event_id: '0', + type: 'transaction', transaction: transaction.name, contexts: { trace: transaction.getTraceContext(), diff --git a/test/tracing/reactnativenavigation.test.ts b/test/tracing/reactnativenavigation.test.ts index 77d87e961..e2a126c03 100644 --- a/test/tracing/reactnativenavigation.test.ts +++ b/test/tracing/reactnativenavigation.test.ts @@ -1,15 +1,15 @@ /* eslint-disable @typescript-eslint/no-empty-function */ -import { TransactionContext } from "@sentry/types"; -import { EmitterSubscription } from "react-native"; +import { TransactionContext } from '@sentry/types'; +import { EmitterSubscription } from 'react-native'; import { ComponentWillAppearEvent, EventsRegistry, NavigationDelegate, ReactNativeNavigationInstrumentation, -} from "../../src/js/tracing/reactnativenavigation"; -import { getBlankTransactionContext } from "../../src/js/tracing/utils"; -import { getMockTransaction } from "../testutils"; +} from '../../src/js/tracing/reactnativenavigation'; +import { getBlankTransactionContext } from '../../src/js/tracing/utils'; +import { getMockTransaction } from '../testutils'; interface MockEventsRegistry extends EventsRegistry { componentWillAppearListener?: (event: ComponentWillAppearEvent) => void; @@ -49,8 +49,8 @@ const mockNavigationDelegate: NavigationDelegate = { }, }; -describe("React Native Navigation Instrumentation", () => { - test("Correctly instruments a route change", () => { +describe('React Native Navigation Instrumentation', () => { + test('Correctly instruments a route change', () => { const instrumentation = new ReactNativeNavigationInstrumentation( mockNavigationDelegate ); @@ -65,14 +65,14 @@ describe("React Native Navigation Instrumentation", () => { () => {} ); - mockEventsRegistry.onCommand("root", {}); + mockEventsRegistry.onCommand('root', {}); - expect(mockTransaction.name).toBe("Route Change"); + expect(mockTransaction.name).toBe('Route Change'); const mockEvent: ComponentWillAppearEvent = { - componentId: "0", - componentName: "Test", - componentType: "Component", + componentId: '0', + componentName: 'Test', + componentType: 'Component', passProps: {}, }; mockEventsRegistry.onComponentWillAppear(mockEvent); @@ -82,7 +82,7 @@ describe("React Native Navigation Instrumentation", () => { ...getBlankTransactionContext( ReactNativeNavigationInstrumentation.instrumentationName ).tags, - "routing.route.name": mockEvent.componentName, + 'routing.route.name': mockEvent.componentName, }); expect(mockTransaction.data).toStrictEqual({ route: { @@ -94,7 +94,7 @@ describe("React Native Navigation Instrumentation", () => { }); }); - test("Transaction context is changed with beforeNavigate", () => { + test('Transaction context is changed with beforeNavigate', () => { const instrumentation = new ReactNativeNavigationInstrumentation( mockNavigationDelegate ); @@ -107,34 +107,34 @@ describe("React Native Navigation Instrumentation", () => { tracingListener, (context) => { context.sampled = false; - context.description = "Description"; - context.name = "New Name"; + context.description = 'Description'; + context.name = 'New Name'; return context; }, () => {} ); - mockEventsRegistry.onCommand("root", {}); + mockEventsRegistry.onCommand('root', {}); - expect(mockTransaction.name).toBe("Route Change"); + expect(mockTransaction.name).toBe('Route Change'); const mockEvent: ComponentWillAppearEvent = { - componentId: "0", - componentName: "Test", - componentType: "Component", + componentId: '0', + componentName: 'Test', + componentType: 'Component', passProps: {}, }; mockEventsRegistry.onComponentWillAppear(mockEvent); - expect(mockTransaction.name).toBe("New Name"); - expect(mockTransaction.description).toBe("Description"); + expect(mockTransaction.name).toBe('New Name'); + expect(mockTransaction.description).toBe('Description'); expect(mockTransaction.sampled).toBe(false); expect(mockTransaction.tags).toStrictEqual({ ...getBlankTransactionContext( ReactNativeNavigationInstrumentation.instrumentationName ).tags, - "routing.route.name": mockEvent.componentName, + 'routing.route.name': mockEvent.componentName, }); expect(mockTransaction.data).toStrictEqual({ route: { @@ -146,7 +146,7 @@ describe("React Native Navigation Instrumentation", () => { }); }); - test("Transaction not sent on a cancelled route change", () => { + test('Transaction not sent on a cancelled route change', () => { jest.useFakeTimers(); const instrumentation = new ReactNativeNavigationInstrumentation( @@ -163,9 +163,9 @@ describe("React Native Navigation Instrumentation", () => { () => {} ); - mockEventsRegistry.onCommand("root", {}); + mockEventsRegistry.onCommand('root', {}); - expect(mockTransaction.name).toBe("Route Change"); + expect(mockTransaction.name).toBe('Route Change'); expect(mockTransaction.sampled).toBe(true); jest.runAllTimers(); @@ -175,7 +175,7 @@ describe("React Native Navigation Instrumentation", () => { jest.useRealTimers(); }); - test("Transaction not sent if route change timeout is passed", () => { + test('Transaction not sent if route change timeout is passed', () => { jest.useFakeTimers(); const instrumentation = new ReactNativeNavigationInstrumentation( @@ -193,29 +193,29 @@ describe("React Native Navigation Instrumentation", () => { () => {} ); - mockEventsRegistry.onCommand("root", {}); + mockEventsRegistry.onCommand('root', {}); - expect(mockTransaction.name).toBe("Route Change"); + expect(mockTransaction.name).toBe('Route Change'); expect(mockTransaction.sampled).toBe(true); jest.runAllTimers(); const mockEvent: ComponentWillAppearEvent = { - componentId: "0", - componentName: "Test", - componentType: "Component", + componentId: '0', + componentName: 'Test', + componentType: 'Component', passProps: {}, }; mockEventsRegistry.onComponentWillAppear(mockEvent); expect(mockTransaction.sampled).toBe(false); - expect(mockTransaction.name).not.toBe("Test"); + expect(mockTransaction.name).not.toBe('Test'); jest.useRealTimers(); }); - describe("onRouteConfirmed", () => { - test("onRouteConfirmed called with correct route data", () => { + describe('onRouteConfirmed', () => { + test('onRouteConfirmed called with correct route data', () => { const instrumentation = new ReactNativeNavigationInstrumentation( mockNavigationDelegate ); @@ -233,24 +233,24 @@ describe("React Native Navigation Instrumentation", () => { } ); - mockEventsRegistry.onCommand("root", {}); + mockEventsRegistry.onCommand('root', {}); - expect(mockTransaction.name).toBe("Route Change"); + expect(mockTransaction.name).toBe('Route Change'); const mockEvent1: ComponentWillAppearEvent = { - componentId: "1", - componentName: "Test 1", - componentType: "Component", + componentId: '1', + componentName: 'Test 1', + componentType: 'Component', passProps: {}, }; mockEventsRegistry.onComponentWillAppear(mockEvent1); - mockEventsRegistry.onCommand("root", {}); + mockEventsRegistry.onCommand('root', {}); const mockEvent2: ComponentWillAppearEvent = { - componentId: "2", - componentName: "Test 2", - componentType: "Component", + componentId: '2', + componentName: 'Test 2', + componentType: 'Component', passProps: {}, }; mockEventsRegistry.onComponentWillAppear(mockEvent2); @@ -273,7 +273,7 @@ describe("React Native Navigation Instrumentation", () => { } }); - test("onRouteConfirmed clears transaction", () => { + test('onRouteConfirmed clears transaction', () => { const instrumentation = new ReactNativeNavigationInstrumentation( mockNavigationDelegate ); @@ -291,22 +291,22 @@ describe("React Native Navigation Instrumentation", () => { } ); - mockEventsRegistry.onCommand("root", {}); + mockEventsRegistry.onCommand('root', {}); - expect(mockTransaction.name).toBe("Route Change"); + expect(mockTransaction.name).toBe('Route Change'); const mockEvent1: ComponentWillAppearEvent = { - componentId: "1", - componentName: "Test 1", - componentType: "Component", + componentId: '1', + componentName: 'Test 1', + componentType: 'Component', passProps: {}, }; mockEventsRegistry.onComponentWillAppear(mockEvent1); const mockEvent2: ComponentWillAppearEvent = { - componentId: "2", - componentName: "Test 2", - componentType: "Component", + componentId: '2', + componentName: 'Test 2', + componentType: 'Component', passProps: {}, }; mockEventsRegistry.onComponentWillAppear(mockEvent2); diff --git a/test/tracing/reactnativetracing.test.ts b/test/tracing/reactnativetracing.test.ts index 2e5adbabd..0dda06abc 100644 --- a/test/tracing/reactnativetracing.test.ts +++ b/test/tracing/reactnativetracing.test.ts @@ -1,12 +1,12 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { BrowserClient } from "@sentry/browser"; -import { addGlobalEventProcessor, Hub } from "@sentry/hub"; -import { IdleTransaction, Transaction } from "@sentry/tracing"; +import { BrowserClient } from '@sentry/browser'; +import { addGlobalEventProcessor, Hub } from '@sentry/hub'; +import { IdleTransaction, Transaction } from '@sentry/tracing'; -import { NativeAppStartResponse } from "../../src/js/definitions"; -import { RoutingInstrumentation } from "../../src/js/tracing/routingInstrumentation"; +import { NativeAppStartResponse } from '../../src/js/definitions'; +import { RoutingInstrumentation } from '../../src/js/tracing/routingInstrumentation'; -jest.mock("../../src/js/wrapper", () => { +jest.mock('../../src/js/wrapper', () => { return { NATIVE: { fetchNativeAppStart: jest.fn(), @@ -17,8 +17,8 @@ jest.mock("../../src/js/wrapper", () => { }; }); -jest.mock("../../src/js/tracing/utils", () => { - const originalUtils = jest.requireActual("../../src/js/tracing/utils"); +jest.mock('../../src/js/tracing/utils', () => { + const originalUtils = jest.requireActual('../../src/js/tracing/utils'); return { ...originalUtils, @@ -51,10 +51,10 @@ const getMockHub = () => { return mockHub; }; -import { ReactNativeTracing } from "../../src/js/tracing/reactnativetracing"; -import { getTimeOriginMilliseconds } from "../../src/js/tracing/utils"; -import { NATIVE } from "../../src/js/wrapper"; -import { mockFunction } from "../testutils"; +import { ReactNativeTracing } from '../../src/js/tracing/reactnativetracing'; +import { getTimeOriginMilliseconds } from '../../src/js/tracing/utils'; +import { NATIVE } from '../../src/js/wrapper'; +import { mockFunction } from '../testutils'; beforeEach(() => { NATIVE.enableNative = true; @@ -65,10 +65,10 @@ afterEach(() => { jest.clearAllMocks(); }); -describe("ReactNativeTracing", () => { - describe("App Start", () => { - describe("Without routing instrumentation", () => { - it("Starts route transaction (cold)", (done) => { +describe('ReactNativeTracing', () => { + describe('App Start', () => { + describe('Without routing instrumentation', () => { + it('Starts route transaction (cold)', (done) => { const integration = new ReactNativeTracing({ enableNativeFramesTracking: false, }); @@ -105,7 +105,7 @@ describe("ReactNativeTracing", () => { expect(transaction.startTimestamp).toBe( appStartTimeMilliseconds / 1000 ); - expect(transaction.op).toBe("ui.load"); + expect(transaction.op).toBe('ui.load'); expect( // @ts-ignore access private for test @@ -117,7 +117,7 @@ describe("ReactNativeTracing", () => { }); }); - it("Starts route transaction (warm)", (done) => { + it('Starts route transaction (warm)', (done) => { const integration = new ReactNativeTracing(); const timeOriginMilliseconds = Date.now(); @@ -151,7 +151,7 @@ describe("ReactNativeTracing", () => { expect(transaction.startTimestamp).toBe( appStartTimeMilliseconds / 1000 ); - expect(transaction.op).toBe("ui.load"); + expect(transaction.op).toBe('ui.load'); expect( // @ts-ignore access private for test @@ -163,7 +163,7 @@ describe("ReactNativeTracing", () => { }); }); - it("Does not create app start transaction if didFetchAppStart == true", (done) => { + it('Does not create app start transaction if didFetchAppStart == true', (done) => { const integration = new ReactNativeTracing(); const timeOriginMilliseconds = Date.now(); @@ -198,8 +198,8 @@ describe("ReactNativeTracing", () => { }); }); - describe("With routing instrumentation", () => { - it("Adds measurements and child span onto existing routing transaction and sets the op (cold)", (done) => { + describe('With routing instrumentation', () => { + it('Adds measurements and child span onto existing routing transaction and sets the op (cold)', (done) => { const routingInstrumentation = new RoutingInstrumentation(); const integration = new ReactNativeTracing({ routingInstrumentation, @@ -231,7 +231,7 @@ describe("ReactNativeTracing", () => { expect(transaction).toBeUndefined(); const routeTransaction = routingInstrumentation.onRouteWillChange({ - name: "test", + name: 'test', }) as IdleTransaction; routeTransaction.initSpanRecorder(10); @@ -246,7 +246,7 @@ describe("ReactNativeTracing", () => { timeOriginMilliseconds - appStartTimeMilliseconds ); - expect(routeTransaction.op).toBe("ui.load"); + expect(routeTransaction.op).toBe('ui.load'); expect(routeTransaction.startTimestamp).toBe( appStartTimeMilliseconds / 1000 ); @@ -258,8 +258,8 @@ describe("ReactNativeTracing", () => { const span = spanRecorder.spans[spanRecorder.spans.length - 1]; - expect(span.op).toBe("app.start.cold"); - expect(span.description).toBe("Cold App Start"); + expect(span.op).toBe('app.start.cold'); + expect(span.description).toBe('Cold App Start'); expect(span.startTimestamp).toBe(appStartTimeMilliseconds / 1000); expect(span.endTimestamp).toBe(timeOriginMilliseconds / 1000); } @@ -269,7 +269,7 @@ describe("ReactNativeTracing", () => { }); }); - it("Adds measurements and child span onto existing routing transaction and sets the op (cold)", (done) => { + it('Adds measurements and child span onto existing routing transaction and sets the op (cold)', (done) => { const routingInstrumentation = new RoutingInstrumentation(); const integration = new ReactNativeTracing({ routingInstrumentation, @@ -301,7 +301,7 @@ describe("ReactNativeTracing", () => { expect(transaction).toBeUndefined(); const routeTransaction = routingInstrumentation.onRouteWillChange({ - name: "test", + name: 'test', }) as IdleTransaction; routeTransaction.initSpanRecorder(10); @@ -316,7 +316,7 @@ describe("ReactNativeTracing", () => { timeOriginMilliseconds - appStartTimeMilliseconds ); - expect(routeTransaction.op).toBe("ui.load"); + expect(routeTransaction.op).toBe('ui.load'); expect(routeTransaction.startTimestamp).toBe( appStartTimeMilliseconds / 1000 ); @@ -328,8 +328,8 @@ describe("ReactNativeTracing", () => { const span = spanRecorder.spans[spanRecorder.spans.length - 1]; - expect(span.op).toBe("app.start.warm"); - expect(span.description).toBe("Warm App Start"); + expect(span.op).toBe('app.start.warm'); + expect(span.description).toBe('Warm App Start'); expect(span.startTimestamp).toBe(appStartTimeMilliseconds / 1000); expect(span.endTimestamp).toBe(timeOriginMilliseconds / 1000); } @@ -339,7 +339,7 @@ describe("ReactNativeTracing", () => { }); }); - it("Does not update route transaction if didFetchAppStart == true", (done) => { + it('Does not update route transaction if didFetchAppStart == true', (done) => { const routingInstrumentation = new RoutingInstrumentation(); const integration = new ReactNativeTracing({ routingInstrumentation, @@ -371,7 +371,7 @@ describe("ReactNativeTracing", () => { expect(transaction).toBeUndefined(); const routeTransaction = routingInstrumentation.onRouteWillChange({ - name: "test", + name: 'test', }) as IdleTransaction; routeTransaction.initSpanRecorder(10); @@ -384,7 +384,7 @@ describe("ReactNativeTracing", () => { // @ts-ignore access private for test expect(routeTransaction._measurements).toMatchObject({}); - expect(routeTransaction.op).not.toBe("ui.load"); + expect(routeTransaction.op).not.toBe('ui.load'); expect(routeTransaction.startTimestamp).not.toBe( appStartTimeMilliseconds / 1000 ); @@ -401,7 +401,7 @@ describe("ReactNativeTracing", () => { }); }); - it("Does not instrument app start if app start is disabled", (done) => { + it('Does not instrument app start if app start is disabled', (done) => { const integration = new ReactNativeTracing({ enableAppStartTracking: false, }); @@ -420,7 +420,7 @@ describe("ReactNativeTracing", () => { }); }); - it("Does not instrument app start if native is disabled", (done) => { + it('Does not instrument app start if native is disabled', (done) => { NATIVE.enableNative = false; const integration = new ReactNativeTracing(); @@ -439,7 +439,7 @@ describe("ReactNativeTracing", () => { }); }); - it("Does not instrument app start if fetchNativeAppStart returns null", (done) => { + it('Does not instrument app start if fetchNativeAppStart returns null', (done) => { // eslint-disable-next-line @typescript-eslint/unbound-method mockFunction(NATIVE.fetchNativeAppStart).mockResolvedValue(null); @@ -460,8 +460,8 @@ describe("ReactNativeTracing", () => { }); }); - describe("Native Frames", () => { - it("Does not initialize native frames instrumentation if flag is false", (done) => { + describe('Native Frames', () => { + it('Does not initialize native frames instrumentation if flag is false', (done) => { const integration = new ReactNativeTracing({ enableNativeFramesTracking: false, }); @@ -480,9 +480,9 @@ describe("ReactNativeTracing", () => { }); }); - describe("Routing Instrumentation", () => { - describe("_onConfirmRoute", () => { - it("Sets tag and adds breadcrumb", () => { + describe('Routing Instrumentation', () => { + describe('_onConfirmRoute', () => { + it('Sets tag and adds breadcrumb', () => { const routing = new RoutingInstrumentation(); const integration = new ReactNativeTracing({ routingInstrumentation: routing, @@ -513,25 +513,25 @@ describe("ReactNativeTracing", () => { ); const routeContext = { - name: "Route", + name: 'Route', data: { route: { - name: "Route", + name: 'Route', }, previousRoute: { - name: "Previous Route", + name: 'Previous Route', }, }, }; routing.onRouteWillChange(routeContext); expect(mockScope.setTag).toBeCalledWith( - "routing.route.name", + 'routing.route.name', routeContext.name ); expect(mockScope.addBreadcrumb).toBeCalledWith({ - type: "navigation", - category: "navigation", + type: 'navigation', + category: 'navigation', message: `Navigation to ${routeContext.name}`, data: { from: routeContext.data.previousRoute.name, diff --git a/test/tracing/reactnavigation.test.ts b/test/tracing/reactnavigation.test.ts index da2595849..3d4b78b12 100644 --- a/test/tracing/reactnavigation.test.ts +++ b/test/tracing/reactnavigation.test.ts @@ -1,17 +1,17 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { Transaction } from "@sentry/tracing"; -import { TransactionContext } from "@sentry/types"; -import { getGlobalObject } from "@sentry/utils"; +import { Transaction } from '@sentry/tracing'; +import { TransactionContext } from '@sentry/types'; +import { getGlobalObject } from '@sentry/utils'; import { BLANK_TRANSACTION_CONTEXT, NavigationRoute, ReactNavigationInstrumentation, -} from "../../src/js/tracing/reactnavigation"; +} from '../../src/js/tracing/reactnavigation'; const dummyRoute = { - name: "Route", - key: "0", + name: 'Route', + key: '0', }; class MockNavigationContainer { @@ -46,8 +46,8 @@ afterEach(() => { jest.resetAllMocks(); }); -describe("ReactNavigationInstrumentation", () => { - test("transaction set on initialize", () => { +describe('ReactNavigationInstrumentation', () => { + test('transaction set on initialize', () => { const instrumentation = new ReactNavigationInstrumentation(); const mockTransaction = getMockTransaction(); @@ -69,7 +69,7 @@ describe("ReactNavigationInstrumentation", () => { expect(mockTransaction.name).toBe(dummyRoute.name); expect(mockTransaction.tags).toStrictEqual({ ...BLANK_TRANSACTION_CONTEXT.tags, - "routing.route.name": dummyRoute.name, + 'routing.route.name': dummyRoute.name, }); expect(mockTransaction.data).toStrictEqual({ route: { @@ -82,7 +82,7 @@ describe("ReactNavigationInstrumentation", () => { }); }); - test("transaction sent on navigation", async () => { + test('transaction sent on navigation', async () => { const instrumentation = new ReactNavigationInstrumentation(); // Need a dummy transaction as the instrumentation will start a transaction right away when the first navigation container is attached. @@ -108,24 +108,24 @@ describe("ReactNavigationInstrumentation", () => { const mockTransaction = getMockTransaction(); transactionRef.current = mockTransaction; - mockNavigationContainerRef.current.listeners["__unsafe_action__"]({}); + mockNavigationContainerRef.current.listeners['__unsafe_action__']({}); await new Promise((resolve) => { setTimeout(() => { const route = { - name: "New Route", - key: "1", + name: 'New Route', + key: '1', params: { someParam: 42, }, }; mockNavigationContainerRef.current.currentRoute = route; - mockNavigationContainerRef.current.listeners["state"]({}); + mockNavigationContainerRef.current.listeners['state']({}); expect(mockTransaction.name).toBe(route.name); expect(mockTransaction.tags).toStrictEqual({ ...BLANK_TRANSACTION_CONTEXT.tags, - "routing.route.name": route.name, + 'routing.route.name': route.name, }); expect(mockTransaction.data).toStrictEqual({ route: { @@ -146,7 +146,7 @@ describe("ReactNavigationInstrumentation", () => { }); }); - test("transaction context changed with beforeNavigate", async () => { + test('transaction context changed with beforeNavigate', async () => { const instrumentation = new ReactNavigationInstrumentation(); // Need a dummy transaction as the instrumentation will start a transaction right away when the first navigation container is attached. @@ -159,8 +159,8 @@ describe("ReactNavigationInstrumentation", () => { tracingListener as any, (context) => { context.sampled = false; - context.description = "Description"; - context.name = "New Name"; + context.description = 'Description'; + context.name = 'New Name'; return context; }, @@ -178,26 +178,26 @@ describe("ReactNavigationInstrumentation", () => { const mockTransaction = getMockTransaction(); transactionRef.current = mockTransaction; - mockNavigationContainerRef.current.listeners["__unsafe_action__"]({}); + mockNavigationContainerRef.current.listeners['__unsafe_action__']({}); await new Promise((resolve) => { setTimeout(() => { const route = { - name: "DoNotSend", - key: "1", + name: 'DoNotSend', + key: '1', }; mockNavigationContainerRef.current.currentRoute = route; - mockNavigationContainerRef.current.listeners["state"]({}); + mockNavigationContainerRef.current.listeners['state']({}); expect(mockTransaction.sampled).toBe(false); - expect(mockTransaction.name).toBe("New Name"); - expect(mockTransaction.description).toBe("Description"); + expect(mockTransaction.name).toBe('New Name'); + expect(mockTransaction.description).toBe('Description'); resolve(); }, 50); }); }); - test("transaction not sent on a cancelled navigation", async () => { + test('transaction not sent on a cancelled navigation', async () => { const instrumentation = new ReactNavigationInstrumentation(); // Need a dummy transaction as the instrumentation will start a transaction right away when the first navigation container is attached. @@ -223,7 +223,7 @@ describe("ReactNavigationInstrumentation", () => { const mockTransaction = getMockTransaction(); transactionRef.current = mockTransaction; - mockNavigationContainerRef.current.listeners["__unsafe_action__"]({}); + mockNavigationContainerRef.current.listeners['__unsafe_action__']({}); await new Promise((resolve) => { setTimeout(() => { @@ -240,7 +240,7 @@ describe("ReactNavigationInstrumentation", () => { }); }); - test("transaction not sent on multiple cancelled navigations", async () => { + test('transaction not sent on multiple cancelled navigations', async () => { const instrumentation = new ReactNavigationInstrumentation(); // Need a dummy transaction as the instrumentation will start a transaction right away when the first navigation container is attached. @@ -266,12 +266,12 @@ describe("ReactNavigationInstrumentation", () => { const mockTransaction1 = getMockTransaction(); transactionRef.current = mockTransaction1; - mockNavigationContainerRef.current.listeners["__unsafe_action__"]({}); + mockNavigationContainerRef.current.listeners['__unsafe_action__']({}); const mockTransaction2 = getMockTransaction(); transactionRef.current = mockTransaction2; - mockNavigationContainerRef.current.listeners["__unsafe_action__"]({}); + mockNavigationContainerRef.current.listeners['__unsafe_action__']({}); await new Promise((resolve) => { setTimeout(() => { @@ -282,8 +282,8 @@ describe("ReactNavigationInstrumentation", () => { }); }); - describe("navigation container registration", () => { - test("registers navigation container object ref", () => { + describe('navigation container registration', () => { + test('registers navigation container object ref', () => { const instrumentation = new ReactNavigationInstrumentation(); const mockNavigationContainer = new MockNavigationContainer(); instrumentation.registerNavigationContainer({ @@ -295,18 +295,18 @@ describe("ReactNavigationInstrumentation", () => { // eslint-disable-next-line @typescript-eslint/unbound-method expect(mockNavigationContainer.addListener).toHaveBeenNthCalledWith( 1, - "__unsafe_action__", + '__unsafe_action__', expect.any(Function) ); // eslint-disable-next-line @typescript-eslint/unbound-method expect(mockNavigationContainer.addListener).toHaveBeenNthCalledWith( 2, - "state", + 'state', expect.any(Function) ); }); - test("registers navigation container direct ref", () => { + test('registers navigation container direct ref', () => { const instrumentation = new ReactNavigationInstrumentation(); const mockNavigationContainer = new MockNavigationContainer(); instrumentation.registerNavigationContainer(mockNavigationContainer); @@ -316,18 +316,18 @@ describe("ReactNavigationInstrumentation", () => { // eslint-disable-next-line @typescript-eslint/unbound-method expect(mockNavigationContainer.addListener).toHaveBeenNthCalledWith( 1, - "__unsafe_action__", + '__unsafe_action__', expect.any(Function) ); // eslint-disable-next-line @typescript-eslint/unbound-method expect(mockNavigationContainer.addListener).toHaveBeenNthCalledWith( 2, - "state", + 'state', expect.any(Function) ); }); - test("does not register navigation container if there is an existing one", () => { + test('does not register navigation container if there is an existing one', () => { _global.__sentry_rn_v5_registered = true; const instrumentation = new ReactNavigationInstrumentation(); @@ -344,7 +344,7 @@ describe("ReactNavigationInstrumentation", () => { expect(mockNavigationContainer.addListener).not.toHaveBeenCalled(); }); - test("works if routing instrumentation registration is after navigation registration", async () => { + test('works if routing instrumentation registration is after navigation registration', async () => { const instrumentation = new ReactNavigationInstrumentation(); const mockNavigationContainer = new MockNavigationContainer(); @@ -367,8 +367,8 @@ describe("ReactNavigationInstrumentation", () => { }); }); - describe("options", () => { - test("waits until routeChangeTimeoutMs", async () => { + describe('options', () => { + test('waits until routeChangeTimeoutMs', async () => { const instrumentation = new ReactNavigationInstrumentation({ routeChangeTimeoutMs: 200, }); @@ -399,7 +399,7 @@ describe("ReactNavigationInstrumentation", () => { }); }); - test("discards if after routeChangeTimeoutMs", async () => { + test('discards if after routeChangeTimeoutMs', async () => { const instrumentation = new ReactNavigationInstrumentation({ routeChangeTimeoutMs: 200, }); @@ -429,8 +429,8 @@ describe("ReactNavigationInstrumentation", () => { }); }); - describe("onRouteConfirmed", () => { - test("onRouteConfirmed called with correct route data", () => { + describe('onRouteConfirmed', () => { + test('onRouteConfirmed called with correct route data', () => { const instrumentation = new ReactNavigationInstrumentation(); // Need a dummy transaction as the instrumentation will start a transaction right away when the first navigation container is attached. @@ -459,31 +459,31 @@ describe("ReactNavigationInstrumentation", () => { const mockTransaction = getMockTransaction(); transactionRef.current = mockTransaction; - mockNavigationContainerRef.current.listeners["__unsafe_action__"]({}); + mockNavigationContainerRef.current.listeners['__unsafe_action__']({}); const route1 = { - name: "New Route 1", - key: "1", + name: 'New Route 1', + key: '1', params: { someParam: 42, }, }; mockNavigationContainerRef.current.currentRoute = route1; - mockNavigationContainerRef.current.listeners["state"]({}); + mockNavigationContainerRef.current.listeners['state']({}); - mockNavigationContainerRef.current.listeners["__unsafe_action__"]({}); + mockNavigationContainerRef.current.listeners['__unsafe_action__']({}); const route2 = { - name: "New Route 2", - key: "2", + name: 'New Route 2', + key: '2', params: { someParam: 42, }, }; mockNavigationContainerRef.current.currentRoute = route2; - mockNavigationContainerRef.current.listeners["state"]({}); + mockNavigationContainerRef.current.listeners['state']({}); expect(confirmedContext).toBeDefined(); if (confirmedContext) { diff --git a/test/tracing/reactnavigationv4.test.ts b/test/tracing/reactnavigationv4.test.ts index 1870baeaf..354442598 100644 --- a/test/tracing/reactnavigationv4.test.ts +++ b/test/tracing/reactnavigationv4.test.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { Transaction } from "@sentry/tracing"; -import { TransactionContext } from "@sentry/types"; -import { getGlobalObject } from "@sentry/utils"; +import { Transaction } from '@sentry/tracing'; +import { TransactionContext } from '@sentry/types'; +import { getGlobalObject } from '@sentry/utils'; import { AppContainerInstance, @@ -9,11 +9,11 @@ import { NavigationRouteV4, NavigationStateV4, ReactNavigationV4Instrumentation, -} from "../../src/js/tracing/reactnavigationv4"; +} from '../../src/js/tracing/reactnavigationv4'; const initialRoute = { - routeName: "Initial Route", - key: "route0", + routeName: 'Initial Route', + key: 'route0', params: { hello: true, }, @@ -51,7 +51,7 @@ class MockAppContainer implements AppContainerInstance { this._navigation.state = newState; }, getStateForAction: (action: any, state: NavigationStateV4) => { - if (action.routeName === "DoNotNavigate") { + if (action.routeName === 'DoNotNavigate') { return state; } @@ -73,7 +73,7 @@ class MockAppContainer implements AppContainerInstance { this._navigation = { state: { index: 0, - key: "0", + key: '0', isTransitioning: false, routes: [initialRoute], }, @@ -92,8 +92,8 @@ afterEach(() => { jest.resetAllMocks(); }); -describe("ReactNavigationV4Instrumentation", () => { - test("transaction set on initialize", () => { +describe('ReactNavigationV4Instrumentation', () => { + test('transaction set on initialize', () => { const instrumentation = new ReactNavigationV4Instrumentation(); const mockTransaction = getMockTransaction(); @@ -125,9 +125,9 @@ describe("ReactNavigationV4Instrumentation", () => { expect(mockTransaction.name).toBe(firstRoute.routeName); expect(mockTransaction.tags).toStrictEqual({ - "routing.instrumentation": + 'routing.instrumentation': ReactNavigationV4Instrumentation.instrumentationName, - "routing.route.name": firstRoute.routeName, + 'routing.route.name': firstRoute.routeName, }); expect(mockTransaction.data).toStrictEqual({ route: { @@ -141,7 +141,7 @@ describe("ReactNavigationV4Instrumentation", () => { expect(mockTransaction.sampled).toBe(true); }); - test("transaction sent on navigation", () => { + test('transaction sent on navigation', () => { const instrumentation = new ReactNavigationV4Instrumentation(); const mockTransaction = getMockTransaction(); @@ -161,8 +161,8 @@ describe("ReactNavigationV4Instrumentation", () => { instrumentation.registerAppContainer(mockAppContainerRef as any); const action = { - routeName: "New Route", - key: "key1", + routeName: 'New Route', + key: 'key1', params: { someParam: 42, }, @@ -175,11 +175,11 @@ describe("ReactNavigationV4Instrumentation", () => { // eslint-disable-next-line @typescript-eslint/unbound-method expect(instrumentation.onRouteWillChange).toHaveBeenLastCalledWith({ name: action.routeName, - op: "navigation", + op: 'navigation', tags: { - "routing.instrumentation": + 'routing.instrumentation': ReactNavigationV4Instrumentation.instrumentationName, - "routing.route.name": action.routeName, + 'routing.route.name': action.routeName, }, data: { route: { @@ -189,8 +189,8 @@ describe("ReactNavigationV4Instrumentation", () => { hasBeenSeen: false, }, previousRoute: { - name: "Initial Route", - key: "route0", + name: 'Initial Route', + key: 'route0', params: { hello: true, }, @@ -201,7 +201,7 @@ describe("ReactNavigationV4Instrumentation", () => { expect(mockTransaction.sampled).toBe(true); }); - test("transaction context changed with beforeNavigate", () => { + test('transaction context changed with beforeNavigate', () => { const instrumentation = new ReactNavigationV4Instrumentation(); const mockTransaction = getMockTransaction(); @@ -210,8 +210,8 @@ describe("ReactNavigationV4Instrumentation", () => { tracingListener as any, (context) => { context.sampled = false; - context.description = "Description"; - context.name = "New Name"; + context.description = 'Description'; + context.name = 'New Name'; context.tags = {}; return context; @@ -226,8 +226,8 @@ describe("ReactNavigationV4Instrumentation", () => { instrumentation.registerAppContainer(mockAppContainerRef as any); const action = { - routeName: "DoNotSend", - key: "key1", + routeName: 'DoNotSend', + key: 'key1', params: { someParam: 42, }, @@ -239,9 +239,9 @@ describe("ReactNavigationV4Instrumentation", () => { // eslint-disable-next-line @typescript-eslint/unbound-method expect(tracingListener).toHaveBeenLastCalledWith({ - name: "New Name", - op: "navigation", - description: "Description", + name: 'New Name', + op: 'navigation', + description: 'Description', tags: {}, data: { route: { @@ -251,8 +251,8 @@ describe("ReactNavigationV4Instrumentation", () => { hasBeenSeen: false, }, previousRoute: { - name: "Initial Route", - key: "route0", + name: 'Initial Route', + key: 'route0', params: { hello: true, }, @@ -264,7 +264,7 @@ describe("ReactNavigationV4Instrumentation", () => { expect(mockTransaction.sampled).toBe(false); }); - test("transaction not attached on a cancelled navigation", () => { + test('transaction not attached on a cancelled navigation', () => { const instrumentation = new ReactNavigationV4Instrumentation(); const mockTransaction = getMockTransaction(); @@ -284,7 +284,7 @@ describe("ReactNavigationV4Instrumentation", () => { instrumentation.registerAppContainer(mockAppContainerRef as any); const action = { - routeName: "DoNotNavigate", + routeName: 'DoNotNavigate', }; mockAppContainerRef.current._navigation.router.dispatchAction(action); @@ -292,8 +292,8 @@ describe("ReactNavigationV4Instrumentation", () => { expect(instrumentation.onRouteWillChange).toHaveBeenCalledTimes(1); }); - describe("navigation container registration", () => { - test("registers navigation container object ref", () => { + describe('navigation container registration', () => { + test('registers navigation container object ref', () => { const instrumentation = new ReactNavigationV4Instrumentation(); const mockTransaction = getMockTransaction(); instrumentation.onRouteWillChange = jest.fn(() => mockTransaction); @@ -318,7 +318,7 @@ describe("ReactNavigationV4Instrumentation", () => { expect(mockTransaction.sampled).toBe(true); }); - test("registers navigation container direct ref", () => { + test('registers navigation container direct ref', () => { const instrumentation = new ReactNavigationV4Instrumentation(); const mockTransaction = getMockTransaction(); instrumentation.onRouteWillChange = jest.fn(() => mockTransaction); @@ -341,7 +341,7 @@ describe("ReactNavigationV4Instrumentation", () => { expect(mockTransaction.sampled).toBe(true); }); - test("does not register navigation container if there is an existing one", async () => { + test('does not register navigation container if there is an existing one', async () => { _global.__sentry_rn_v4_registered = true; const instrumentation = new ReactNavigationV4Instrumentation(); @@ -368,7 +368,7 @@ describe("ReactNavigationV4Instrumentation", () => { }); }); - test("works if routing instrumentation registration is after navigation registration", async () => { + test('works if routing instrumentation registration is after navigation registration', async () => { const instrumentation = new ReactNavigationV4Instrumentation(); const mockNavigationContainer = new MockAppContainer(); @@ -391,8 +391,8 @@ describe("ReactNavigationV4Instrumentation", () => { }); }); - describe("options", () => { - test("waits until routeChangeTimeoutMs", async () => { + describe('options', () => { + test('waits until routeChangeTimeoutMs', async () => { const instrumentation = new ReactNavigationV4Instrumentation({ routeChangeTimeoutMs: 200, }); @@ -423,7 +423,7 @@ describe("ReactNavigationV4Instrumentation", () => { }); }); - test("discards if after routeChangeTimeoutMs", async () => { + test('discards if after routeChangeTimeoutMs', async () => { const instrumentation = new ReactNavigationV4Instrumentation({ routeChangeTimeoutMs: 200, }); @@ -453,8 +453,8 @@ describe("ReactNavigationV4Instrumentation", () => { }); }); - describe("onRouteConfirmed", () => { - test("onRouteConfirmed called with correct route data", () => { + describe('onRouteConfirmed', () => { + test('onRouteConfirmed called with correct route data', () => { const instrumentation = new ReactNavigationV4Instrumentation(); const mockTransaction = getMockTransaction(); @@ -477,8 +477,8 @@ describe("ReactNavigationV4Instrumentation", () => { instrumentation.registerAppContainer(mockAppContainerRef as any); const route1 = { - routeName: "New Route 1", - key: "1", + routeName: 'New Route 1', + key: '1', params: { someParam: 42, }, @@ -486,8 +486,8 @@ describe("ReactNavigationV4Instrumentation", () => { mockAppContainerRef.current._navigation.router.dispatchAction(route1); const route2 = { - routeName: "New Route 2", - key: "2", + routeName: 'New Route 2', + key: '2', params: { someParam: 42, }, diff --git a/test/tracing/stalltracking.test.ts b/test/tracing/stalltracking.test.ts index efd8bf9b0..4d98f9883 100644 --- a/test/tracing/stalltracking.test.ts +++ b/test/tracing/stalltracking.test.ts @@ -1,14 +1,14 @@ -import { IdleTransaction, Transaction } from "@sentry/tracing"; -import { Event } from "@sentry/types"; +import { IdleTransaction, Transaction } from '@sentry/tracing'; +import { Event } from '@sentry/types'; -import { StallTrackingInstrumentation } from "../../src/js/tracing/stalltracking"; +import { StallTrackingInstrumentation } from '../../src/js/tracing/stalltracking'; const hub = { captureEvent: jest.fn(), }; -jest.mock("@sentry/hub", () => { - const hubOriginal = jest.requireActual("@sentry/hub"); +jest.mock('@sentry/hub', () => { + const hubOriginal = jest.requireActual('@sentry/hub'); return { ...hubOriginal, @@ -22,7 +22,7 @@ const getLastEvent = (): Event => { const expensiveOperation = () => { const expensiveObject: { value: string[] } = { - value: Array(100000).fill("expensive"), + value: Array(100000).fill('expensive'), }; // This works in sync, so it should stall the js event loop @@ -35,12 +35,12 @@ beforeEach(() => { jest.clearAllMocks(); }); -describe("StallTracking", () => { - it("Stall tracking detects a JS stall", (done) => { +describe('StallTracking', () => { + it('Stall tracking detects a JS stall', (done) => { const stallTracking = new StallTrackingInstrumentation(); const transaction = new Transaction({ - name: "Test Transaction", + name: 'Test Transaction', sampled: true, }); transaction.initSpanRecorder(); @@ -66,11 +66,11 @@ describe("StallTracking", () => { }, 500); }); - it("Stall tracking detects multiple JS stalls", (done) => { + it('Stall tracking detects multiple JS stalls', (done) => { const stallTracking = new StallTrackingInstrumentation(); const transaction = new Transaction({ - name: "Test Transaction", + name: 'Test Transaction', sampled: true, }); transaction.initSpanRecorder(); @@ -99,11 +99,11 @@ describe("StallTracking", () => { }, 500); }); - it("Stall tracking timeout is stopped after finishing all transactions (single)", () => { + it('Stall tracking timeout is stopped after finishing all transactions (single)', () => { const stallTracking = new StallTrackingInstrumentation(); const transaction = new Transaction({ - name: "Test Transaction", + name: 'Test Transaction', sampled: true, }); @@ -119,19 +119,19 @@ describe("StallTracking", () => { expect(stallTracking.isTracking).toBe(false); }); - it("Stall tracking timeout is stopped after finishing all transactions (multiple)", (done) => { + it('Stall tracking timeout is stopped after finishing all transactions (multiple)', (done) => { const stallTracking = new StallTrackingInstrumentation(); const transaction0 = new Transaction({ - name: "Test Transaction 0", + name: 'Test Transaction 0', sampled: true, }); const transaction1 = new Transaction({ - name: "Test Transaction 1", + name: 'Test Transaction 1', sampled: true, }); const transaction2 = new Transaction({ - name: "Test Transaction 2", + name: 'Test Transaction 2', sampled: true, }); @@ -168,11 +168,11 @@ describe("StallTracking", () => { // If the stall tracking does not correctly stop, the process will keep running. We detect this by passing --detectOpenHandles to jest. }); - it("Stall tracking returns measurements format on finish", () => { + it('Stall tracking returns measurements format on finish', () => { const stallTracking = new StallTrackingInstrumentation(); const transaction = new Transaction({ - name: "Test Transaction", + name: 'Test Transaction', sampled: true, }); @@ -195,7 +195,7 @@ describe("StallTracking", () => { const stallTracking = new StallTrackingInstrumentation(); const transaction = new Transaction({ - name: "Test Transaction", + name: 'Test Transaction', sampled: true, }); @@ -208,11 +208,11 @@ describe("StallTracking", () => { expect(measurements).toBeUndefined(); }); - it("Stall tracking supports endTimestamp that is from the last span (trimEnd case)", (done) => { + it('Stall tracking supports endTimestamp that is from the last span (trimEnd case)', (done) => { const stallTracking = new StallTrackingInstrumentation(); const transaction = new Transaction({ - name: "Test Transaction", + name: 'Test Transaction', trimEnd: true, sampled: true, }); @@ -221,7 +221,7 @@ describe("StallTracking", () => { stallTracking.onTransactionStart(transaction); const span = transaction.startChild({ - description: "Test Span", + description: 'Test Span', }); let spanFinishTime: number | undefined; @@ -253,11 +253,11 @@ describe("StallTracking", () => { }, 400); }); - it("Stall tracking rejects endTimestamp that is from the last span if trimEnd is false (trimEnd case)", (done) => { + it('Stall tracking rejects endTimestamp that is from the last span if trimEnd is false (trimEnd case)', (done) => { const stallTracking = new StallTrackingInstrumentation(); const transaction = new Transaction({ - name: "Test Transaction", + name: 'Test Transaction', trimEnd: false, sampled: true, }); @@ -266,7 +266,7 @@ describe("StallTracking", () => { stallTracking.onTransactionStart(transaction); const span = transaction.startChild({ - description: "Test Span", + description: 'Test Span', }); let spanFinishTime: number | undefined; @@ -290,11 +290,11 @@ describe("StallTracking", () => { }, 400); }); - it("Stall tracking rejects endTimestamp even if it is a span time (custom endTimestamp case)", (done) => { + it('Stall tracking rejects endTimestamp even if it is a span time (custom endTimestamp case)', (done) => { const stallTracking = new StallTrackingInstrumentation(); const transaction = new Transaction({ - name: "Test Transaction", + name: 'Test Transaction', sampled: true, }); transaction.initSpanRecorder(); @@ -302,7 +302,7 @@ describe("StallTracking", () => { stallTracking.onTransactionStart(transaction); const span = transaction.startChild({ - description: "Test Span", + description: 'Test Span', }); let spanFinishTime: number | undefined; @@ -316,7 +316,7 @@ describe("StallTracking", () => { setTimeout(() => { expect(spanFinishTime).toEqual(expect.any(Number)); - if (typeof spanFinishTime === "number") { + if (typeof spanFinishTime === 'number') { stallTracking.onTransactionFinish(transaction, spanFinishTime + 0.015); transaction.finish(); const measurements = getLastEvent()?.measurements; @@ -328,11 +328,11 @@ describe("StallTracking", () => { }, 400); }); - it("Stall tracking supports idleTransaction with unfinished spans", (done) => { + it('Stall tracking supports idleTransaction with unfinished spans', (done) => { const stallTracking = new StallTrackingInstrumentation(); const idleTransaction = new IdleTransaction({ - name: "Test Transaction", + name: 'Test Transaction', trimEnd: true, sampled: true, }); @@ -346,7 +346,7 @@ describe("StallTracking", () => { // Span is never finished. idleTransaction.startChild({ - description: "Test Span", + description: 'Test Span', }); setTimeout(() => { @@ -368,11 +368,11 @@ describe("StallTracking", () => { }, 100); }); - it("Stall tracking ignores unfinished spans in normal transactions", (done) => { + it('Stall tracking ignores unfinished spans in normal transactions', (done) => { const stallTracking = new StallTrackingInstrumentation(); const transaction = new Transaction({ - name: "Test Transaction", + name: 'Test Transaction', trimEnd: true, sampled: true, }); @@ -382,12 +382,12 @@ describe("StallTracking", () => { // Span is never finished. transaction.startChild({ - description: "Test Span", + description: 'Test Span', }); // Span will be finished const span = transaction.startChild({ - description: "To Finish", + description: 'To Finish', }); setTimeout(() => { @@ -413,11 +413,11 @@ describe("StallTracking", () => { }, 500); }); - it("Stall tracking only measures stalls inside the final time when trimEnd is used", (done) => { + it('Stall tracking only measures stalls inside the final time when trimEnd is used', (done) => { const stallTracking = new StallTrackingInstrumentation(); const transaction = new Transaction({ - name: "Test Transaction", + name: 'Test Transaction', trimEnd: true, sampled: true, }); @@ -427,7 +427,7 @@ describe("StallTracking", () => { // Span will be finished const span = transaction.startChild({ - description: "To Finish", + description: 'To Finish', }); setTimeout(() => { @@ -460,7 +460,7 @@ describe("StallTracking", () => { expensiveOperation(); }); - it("Stall tracking does not track the first transaction if more than 10 are running", () => { + it('Stall tracking does not track the first transaction if more than 10 are running', () => { const stallTracking = new StallTrackingInstrumentation(); const transactions = new Array(11).fill(0).map((_, i) => { diff --git a/test/transports/native.test.ts b/test/transports/native.test.ts index e736a41ed..bba8c96dd 100644 --- a/test/transports/native.test.ts +++ b/test/transports/native.test.ts @@ -1,17 +1,17 @@ -import { NativeTransport } from "../../src/js/transports/native"; +import { NativeTransport } from '../../src/js/transports/native'; -jest.mock("../../src/js/wrapper", () => ({ +jest.mock('../../src/js/wrapper', () => ({ NATIVE: { sendEvent: jest.fn(() => Promise.resolve({ status: 200 })), }, })); -describe("NativeTransport", () => { - test("call native sendEvent", async () => { +describe('NativeTransport', () => { + test('call native sendEvent', async () => { // TODO: Remove this when we remove the fetch transport hack inside the native transport const transport = new NativeTransport({ dsn: - "https://6890c2f6677340daa4804f8194804ea2@o19635.ingest.sentry.io/148053", + 'https://6890c2f6677340daa4804f8194804ea2@o19635.ingest.sentry.io/148053', }); await expect(transport.sendEvent({})).resolves.toEqual({ status: 200 }); }); diff --git a/test/wrapper.test.ts b/test/wrapper.test.ts index 266d5a03f..9ae5428ad 100644 --- a/test/wrapper.test.ts +++ b/test/wrapper.test.ts @@ -1,13 +1,13 @@ /* eslint-disable @typescript-eslint/unbound-method */ -import { Event, Severity } from "@sentry/types"; -import { logger } from "@sentry/utils"; +import { Event, Severity } from '@sentry/types'; +import { logger } from '@sentry/utils'; -import { SentryNativeBridgeModule } from "../src/js/definitions"; -import { ReactNativeOptions } from "../src/js/options"; -import { NATIVE } from "../src/js/wrapper"; +import { SentryNativeBridgeModule } from '../src/js/definitions'; +import { ReactNativeOptions } from '../src/js/options'; +import { NATIVE } from '../src/js/wrapper'; jest.mock( - "react-native", + 'react-native', () => { let envelopePayload: | string @@ -36,9 +36,9 @@ jest.mock( ), fetchNativeRelease: jest.fn(() => Promise.resolve({ - build: "1.0.0.1", - id: "test-mock", - version: "1.0.0", + build: '1.0.0.1', + id: 'test-mock', + version: '1.0.0', }) ), getStringBytesLength: jest.fn(() => Promise.resolve(1)), @@ -63,7 +63,7 @@ jest.mock( RNSentry, }, Platform: { - OS: "ios", + OS: 'ios', }, }; }, @@ -71,24 +71,24 @@ jest.mock( { virtual: true } ); -const RN = require("react-native"); +const RN = require('react-native'); const RNSentry = RN.NativeModules.RNSentry as SentryNativeBridgeModule; const callAllScopeMethods = () => { NATIVE.addBreadcrumb({ - message: "test", + message: 'test', }); NATIVE.clearBreadcrumbs(); NATIVE.setUser({ - id: "setUser", + id: 'setUser', }); - NATIVE.setTag("key", "value"); - NATIVE.setContext("key", { value: "value" }); - NATIVE.setExtra("key", "value"); + NATIVE.setTag('key', 'value'); + NATIVE.setContext('key', { value: 'value' }); + NATIVE.setExtra('key', 'value'); }; beforeEach(() => { - NATIVE.platform = "ios"; + NATIVE.platform = 'ios'; NATIVE.enableNative = true; }); @@ -96,30 +96,30 @@ afterEach(() => { jest.clearAllMocks(); }); -describe("Tests Native Wrapper", () => { - describe("startWithOptions", () => { - test("calls native module", async () => { - await NATIVE.initNativeSdk({ dsn: "test", enableNative: true }); +describe('Tests Native Wrapper', () => { + describe('startWithOptions', () => { + test('calls native module', async () => { + await NATIVE.initNativeSdk({ dsn: 'test', enableNative: true }); expect(RNSentry.initNativeSdk).toBeCalled(); }); - test("warns if there is no dsn", async () => { + test('warns if there is no dsn', async () => { logger.warn = jest.fn(); await NATIVE.initNativeSdk({ enableNative: true }); expect(RNSentry.initNativeSdk).not.toBeCalled(); expect(logger.warn).toHaveBeenLastCalledWith( - "Warning: No DSN was provided. The Sentry SDK will be disabled. Native SDK will also not be initalized." + 'Warning: No DSN was provided. The Sentry SDK will be disabled. Native SDK will also not be initalized.' ); }); - test("does not call native module with enableNative: false", async () => { + test('does not call native module with enableNative: false', async () => { logger.warn = jest.fn(); await NATIVE.initNativeSdk({ - dsn: "test", + dsn: 'test', enableNative: false, enableNativeNagger: true, }); @@ -127,15 +127,15 @@ describe("Tests Native Wrapper", () => { expect(RNSentry.initNativeSdk).not.toBeCalled(); expect(NATIVE.enableNative).toBe(false); expect(logger.warn).toHaveBeenLastCalledWith( - "Note: Native Sentry SDK is disabled." + 'Note: Native Sentry SDK is disabled.' ); }); - test("does not initialize with autoInitializeNativeSdk: false", async () => { + test('does not initialize with autoInitializeNativeSdk: false', async () => { logger.warn = jest.fn(); await NATIVE.initNativeSdk({ - dsn: "test", + dsn: 'test', enableNative: true, autoInitializeNativeSdk: false, }); @@ -146,27 +146,27 @@ describe("Tests Native Wrapper", () => { // Test that native bridge methods will go through callAllScopeMethods(); expect(RNSentry.addBreadcrumb).toBeCalledWith({ - message: "test", + message: 'test', }); expect(RNSentry.clearBreadcrumbs).toBeCalled(); expect(RNSentry.setUser).toBeCalledWith( { - id: "setUser", + id: 'setUser', }, {} ); - expect(RNSentry.setTag).toBeCalledWith("key", "value"); - expect(RNSentry.setContext).toBeCalledWith("key", { - value: "value", + expect(RNSentry.setTag).toBeCalledWith('key', 'value'); + expect(RNSentry.setContext).toBeCalledWith('key', { + value: 'value', }); - expect(RNSentry.setExtra).toBeCalledWith("key", "value"); + expect(RNSentry.setExtra).toBeCalledWith('key', 'value'); }); - test("enableNative: false takes precedence over autoInitializeNativeSdk: false", async () => { + test('enableNative: false takes precedence over autoInitializeNativeSdk: false', async () => { logger.warn = jest.fn(); await NATIVE.initNativeSdk({ - dsn: "test", + dsn: 'test', enableNative: false, autoInitializeNativeSdk: false, }); @@ -185,14 +185,14 @@ describe("Tests Native Wrapper", () => { }); }); - describe("sendEvent", () => { - test("calls only captureEnvelope on iOS", async () => { + describe('sendEvent', () => { + test('calls only captureEnvelope on iOS', async () => { const event = { - event_id: "event0", - message: "test", + event_id: 'event0', + message: 'test', sdk: { - name: "test-sdk-name", - version: "2.1.3", + name: 'test-sdk-name', + version: '2.1.3', }, }; @@ -211,18 +211,18 @@ describe("Tests Native Wrapper", () => { }, }); }); - test("serializes class instances on iOS", async () => { + test('serializes class instances on iOS', async () => { class TestInstance { value: number = 0; method = () => null; } const event = { - event_id: "event0", - message: "test", + event_id: 'event0', + message: 'test', sdk: { - name: "test-sdk-name", - version: "2.1.3", + name: 'test-sdk-name', + version: '2.1.3', }, instance: new TestInstance(), }; @@ -245,8 +245,8 @@ describe("Tests Native Wrapper", () => { }, }); }); - test("serializes class instances on Android", async () => { - NATIVE.platform = "android"; + test('serializes class instances on Android', async () => { + NATIVE.platform = 'android'; class TestInstance { value: number = 0; @@ -254,11 +254,11 @@ describe("Tests Native Wrapper", () => { } const event = { - event_id: "event0", - message: "test", + event_id: 'event0', + message: 'test', sdk: { - name: "test-sdk-name", - version: "2.1.3", + name: 'test-sdk-name', + version: '2.1.3', }, instance: new TestInstance(), }; @@ -270,9 +270,9 @@ describe("Tests Native Wrapper", () => { sdk: event.sdk, }); const itemString = JSON.stringify({ - content_type: "application/json", + content_type: 'application/json', length: 1, - type: "event", + type: 'event', }); const payloadString = JSON.stringify({ ...event, @@ -288,15 +288,15 @@ describe("Tests Native Wrapper", () => { `${headerString}\n${itemString}\n${payloadString}` ); }); - test("calls getStringByteLength and captureEnvelope on android", async () => { - NATIVE.platform = "android"; + test('calls getStringByteLength and captureEnvelope on android', async () => { + NATIVE.platform = 'android'; const event = { - event_id: "event0", - message: "test", + event_id: 'event0', + message: 'test', sdk: { - name: "test-sdk-name", - version: "2.1.3", + name: 'test-sdk-name', + version: '2.1.3', }, }; @@ -311,9 +311,9 @@ describe("Tests Native Wrapper", () => { sdk: event.sdk, }); const item = JSON.stringify({ - content_type: "application/json", + content_type: 'application/json', length: 1, - type: "event", + type: 'event', }); await NATIVE.sendEvent(event); @@ -323,35 +323,35 @@ describe("Tests Native Wrapper", () => { `${header}\n${item}\n${payload}` ); }); - test("does not call RNSentry at all if enableNative is false", async () => { + test('does not call RNSentry at all if enableNative is false', async () => { try { - await NATIVE.initNativeSdk({ dsn: "test-dsn", enableNative: false }); + await NATIVE.initNativeSdk({ dsn: 'test-dsn', enableNative: false }); await NATIVE.sendEvent({}); } catch (e) { - expect(e.message).toMatch("Native is disabled"); + expect(e.message).toMatch('Native is disabled'); } expect(RNSentry.getStringBytesLength).not.toBeCalled(); expect(RNSentry.captureEnvelope).not.toBeCalled(); }); - test("Clears breadcrumbs on Android if mechanism.handled is true", async () => { - NATIVE.platform = "android"; + test('Clears breadcrumbs on Android if mechanism.handled is true', async () => { + NATIVE.platform = 'android'; const event: Event = { - event_id: "event0", - message: "test", + event_id: 'event0', + message: 'test', exception: { values: [ { mechanism: { handled: true, - type: "", + type: '', }, }, ], }, breadcrumbs: [ { - message: "crumb!", + message: 'crumb!', }, ], }; @@ -368,9 +368,9 @@ describe("Tests Native Wrapper", () => { sdk: event.sdk, }); const item = JSON.stringify({ - content_type: "application/json", + content_type: 'application/json', length: 1, - type: "event", + type: 'event', }); await NATIVE.sendEvent(event); @@ -380,15 +380,15 @@ describe("Tests Native Wrapper", () => { `${header}\n${item}\n${payload}` ); }); - test("Clears breadcrumbs on Android if there is no exception", async () => { - NATIVE.platform = "android"; + test('Clears breadcrumbs on Android if there is no exception', async () => { + NATIVE.platform = 'android'; const event: Event = { - event_id: "event0", - message: "test", + event_id: 'event0', + message: 'test', breadcrumbs: [ { - message: "crumb!", + message: 'crumb!', }, ], }; @@ -405,9 +405,9 @@ describe("Tests Native Wrapper", () => { sdk: event.sdk, }); const item = JSON.stringify({ - content_type: "application/json", + content_type: 'application/json', length: 1, - type: "event", + type: 'event', }); await NATIVE.sendEvent(event); @@ -417,25 +417,25 @@ describe("Tests Native Wrapper", () => { `${header}\n${item}\n${payload}` ); }); - test("Does not clear breadcrumbs on Android if mechanism.handled is false", async () => { - NATIVE.platform = "android"; + test('Does not clear breadcrumbs on Android if mechanism.handled is false', async () => { + NATIVE.platform = 'android'; const event: Event = { - event_id: "event0", - message: "test", + event_id: 'event0', + message: 'test', exception: { values: [ { mechanism: { handled: false, - type: "", + type: '', }, }, ], }, breadcrumbs: [ { - message: "crumb!", + message: 'crumb!', }, ], }; @@ -451,9 +451,9 @@ describe("Tests Native Wrapper", () => { sdk: event.sdk, }); const item = JSON.stringify({ - content_type: "application/json", + content_type: 'application/json', length: 1, - type: "event", + type: 'event', }); await NATIVE.sendEvent(event); @@ -465,19 +465,19 @@ describe("Tests Native Wrapper", () => { }); }); - describe("fetchRelease", () => { - test("fetches the release from native", async () => { + describe('fetchRelease', () => { + test('fetches the release from native', async () => { await expect(NATIVE.fetchNativeRelease()).resolves.toMatchObject({ - build: "1.0.0.1", - id: "test-mock", - version: "1.0.0", + build: '1.0.0.1', + id: 'test-mock', + version: '1.0.0', }); }); }); - describe("deviceContexts", () => { - test("returns context object from native module on ios", async () => { - NATIVE.platform = "ios"; + describe('deviceContexts', () => { + test('returns context object from native module on ios', async () => { + NATIVE.platform = 'ios'; await expect(NATIVE.fetchNativeDeviceContexts()).resolves.toMatchObject({ someContext: { @@ -487,8 +487,8 @@ describe("Tests Native Wrapper", () => { expect(RNSentry.fetchNativeDeviceContexts).toBeCalled(); }); - test("returns empty object on android", async () => { - NATIVE.platform = "android"; + test('returns empty object on android', async () => { + NATIVE.platform = 'android'; await expect(NATIVE.fetchNativeDeviceContexts()).resolves.toMatchObject( {} @@ -498,30 +498,30 @@ describe("Tests Native Wrapper", () => { }); }); - describe("isModuleLoaded", () => { - test("returns true when module is loaded", () => { + describe('isModuleLoaded', () => { + test('returns true when module is loaded', () => { expect(NATIVE._isModuleLoaded(RNSentry)).toBe(true); }); }); - describe("crash", () => { - test("calls the native crash", () => { + describe('crash', () => { + test('calls the native crash', () => { NATIVE.nativeCrash(); expect(RNSentry.crash).toBeCalled(); }); - test("does not call crash if enableNative is false", async () => { - await NATIVE.initNativeSdk({ dsn: "test-dsn", enableNative: false }); + test('does not call crash if enableNative is false', async () => { + await NATIVE.initNativeSdk({ dsn: 'test-dsn', enableNative: false }); NATIVE.nativeCrash(); expect(RNSentry.crash).not.toBeCalled(); }); }); - describe("setUser", () => { - test("serializes all user object keys", async () => { + describe('setUser', () => { + test('serializes all user object keys', async () => { NATIVE.setUser({ - email: "hello@sentry.io", + email: 'hello@sentry.io', // @ts-ignore Intentional incorrect type to simulate using a double as an id (We had a user open an issue because this didn't work before) id: 3.14159265359, unique: 123, @@ -529,35 +529,35 @@ describe("Tests Native Wrapper", () => { expect(RNSentry.setUser).toBeCalledWith( { - email: "hello@sentry.io", - id: "3.14159265359", + email: 'hello@sentry.io', + id: '3.14159265359', }, { - unique: "123", + unique: '123', } ); }); - test("Calls native setUser with empty object as second param if no unique keys", async () => { + test('Calls native setUser with empty object as second param if no unique keys', async () => { NATIVE.setUser({ - id: "Hello", + id: 'Hello', }); expect(RNSentry.setUser).toBeCalledWith( { - id: "Hello", + id: 'Hello', }, {} ); }); }); - describe("_processLevel", () => { - test("converts deprecated levels", () => { + describe('_processLevel', () => { + test('converts deprecated levels', () => { expect(NATIVE._processLevel(Severity.Log)).toBe(Severity.Debug); expect(NATIVE._processLevel(Severity.Critical)).toBe(Severity.Fatal); }); - test("returns non-deprecated levels", () => { + test('returns non-deprecated levels', () => { expect(NATIVE._processLevel(Severity.Debug)).toBe(Severity.Debug); expect(NATIVE._processLevel(Severity.Fatal)).toBe(Severity.Fatal); expect(NATIVE._processLevel(Severity.Info)).toBe(Severity.Info); @@ -566,8 +566,8 @@ describe("Tests Native Wrapper", () => { }); }); - describe("closeNativeSdk", () => { - test("closeNativeSdk calls native bridge", async () => { + describe('closeNativeSdk', () => { + test('closeNativeSdk calls native bridge', async () => { await NATIVE.closeNativeSdk(); expect(RNSentry.closeNativeSdk).toBeCalled(); diff --git a/yarn.lock b/yarn.lock index 436fc2f1c..458605870 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1123,13 +1123,13 @@ sudo-prompt "^9.0.0" wcwidth "^1.0.1" -"@sentry-internal/eslint-config-sdk@6.17.9": - version "6.17.9" - resolved "https://registry.yarnpkg.com/@sentry-internal/eslint-config-sdk/-/eslint-config-sdk-6.17.9.tgz#b868839d3dba5092f0f4771c02e25c34f2476daa" - integrity sha512-/HpkkHMCG+RKb0y3juW9L9zmAswXwqsMGzNfQWOCEibwwV0mfe7ngXWxzc2XNsjoMUe7rymvJZrdL6kcc5Cu/Q== +"@sentry-internal/eslint-config-sdk@6.19.2": + version "6.19.2" + resolved "https://registry.yarnpkg.com/@sentry-internal/eslint-config-sdk/-/eslint-config-sdk-6.19.2.tgz#1a3d84f4f9a6ded3bd16f6eb5211e15e45a8c2b2" + integrity sha512-M8VidBIMBWqsnvtdgAdlUcq0bfB3bcuD7H/8Qvv9wzDrBCmaznOBy1/HQAMXp32WfVTpF1UfAD9hyufUidbEVw== dependencies: - "@sentry-internal/eslint-plugin-sdk" "6.17.9" - "@sentry-internal/typescript" "6.17.9" + "@sentry-internal/eslint-plugin-sdk" "6.19.2" + "@sentry-internal/typescript" "6.19.2" "@typescript-eslint/eslint-plugin" "^3.9.0" "@typescript-eslint/parser" "^3.9.0" eslint-config-prettier "^6.11.0" @@ -1138,29 +1138,29 @@ eslint-plugin-jsdoc "^30.0.3" eslint-plugin-simple-import-sort "^5.0.3" -"@sentry-internal/eslint-plugin-sdk@6.17.9": - version "6.17.9" - resolved "https://registry.yarnpkg.com/@sentry-internal/eslint-plugin-sdk/-/eslint-plugin-sdk-6.17.9.tgz#6c1dd2aee6c682cef66008bbc9f07ac7ecd1d88a" - integrity sha512-s+wTtLsqrK6/i6+eaJW5OOErWVULucJZdeHtt0Zujzb6+FDe5OMkzrGDY+3nH5a1XOR3BG1teBrxssPJBzcObw== +"@sentry-internal/eslint-plugin-sdk@6.19.2": + version "6.19.2" + resolved "https://registry.yarnpkg.com/@sentry-internal/eslint-plugin-sdk/-/eslint-plugin-sdk-6.19.2.tgz#2b0880fc950bc96b6b629b1557910ed6f8becc89" + integrity sha512-f9f8XD7dqsQZZV2jR7ebhgIswacj2SPxq5fwXHHemPXyX7OkWngAF2mD5GGsZcn2p9XxFNDm7508d5+locJh8Q== dependencies: requireindex "~1.1.0" -"@sentry-internal/typescript@6.17.9": - version "6.17.9" - resolved "https://registry.yarnpkg.com/@sentry-internal/typescript/-/typescript-6.17.9.tgz#a90c3df520288bb53f5472ac8b8adefc6698ae37" - integrity sha512-oPd7uhs0j/0k0U5dZefY0SDkU+0n8m+lKY5A1Xrk9vBsa9Ftv9hSGE1KswSjR8FYTIXfNL03013qlHDEdohCTA== +"@sentry-internal/typescript@6.19.2": + version "6.19.2" + resolved "https://registry.yarnpkg.com/@sentry-internal/typescript/-/typescript-6.19.2.tgz#6e1915269fe40cefcf6f2a862c3731ff4a476401" + integrity sha512-IEgMqiq7IsUCcOWGxK8PaIWdE8kQwlzyyQethLTDx8XtR0c+1vxsdBuFLVKZ0wR0NIrteMW89QKO2mW98Ns5sQ== dependencies: tslint-config-prettier "^1.18.0" tslint-consistent-codestyle "^1.15.1" -"@sentry/browser@6.17.9": - version "6.17.9" - resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.17.9.tgz#62eac0cc3c7c788df6b4677fe9882d3974d84027" - integrity sha512-RsC8GBZmZ3YfBTaIOJ06RlFp5zG7BkUoquNJmf4YhRUZeihT9osrn8qUYGFWSV/UduwKUIlSGJA/rATWWhwPRQ== +"@sentry/browser@6.19.2": + version "6.19.2" + resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.19.2.tgz#c0f6df07584f3b36fa037067aea20b2c8c2095a3" + integrity sha512-5VC44p5Vu2eJhVT39nLAJFgha5MjHDYCyZRR1ieeZt3a++otojPGBBAKNAtrEMGV+A2Z9AoneD6ZnDVlyb3GKg== dependencies: - "@sentry/core" "6.17.9" - "@sentry/types" "6.17.9" - "@sentry/utils" "6.17.9" + "@sentry/core" "6.19.2" + "@sentry/types" "6.19.2" + "@sentry/utils" "6.19.2" tslib "^1.9.3" "@sentry/cli@^1.52.4": @@ -1174,86 +1174,87 @@ progress "^2.0.3" proxy-from-env "^1.1.0" -"@sentry/cli@^1.72.0": - version "1.72.0" - resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-1.72.0.tgz#840fa18c8d5bde61b6b3c4ec82e425b078e70eb2" - integrity sha512-GiVoEarTYjFgHZo5Zjx74HaJWuEhvmvzPhFyC7k5zEK/NWpq3C3SNXrdPQELkEJhLliRNw0pLwRewPpT+vpwlg== +"@sentry/cli@^1.74.2": + version "1.74.2" + resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-1.74.2.tgz#3821ec2fe1a027c6bb6c802ea3ae4f63a21e2533" + integrity sha512-J1P66/4yNN55PMO70+QQXeS87r4O9nYuJqZ29HJCPA/ih57jbMFRw9Wp9XLuO/QtpF8Yl7FvOwya/nImTOVOkA== dependencies: https-proxy-agent "^5.0.0" mkdirp "^0.5.5" - node-fetch "^2.6.0" + node-fetch "^2.6.7" npmlog "^4.1.2" progress "^2.0.3" proxy-from-env "^1.1.0" + which "^2.0.2" -"@sentry/core@6.17.9": - version "6.17.9" - resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.17.9.tgz#1c09f1f101207952566349a1921d46db670c8f62" - integrity sha512-14KalmTholGUtgdh9TklO+jUpyQ/D3OGkhlH1rnGQGoJgFy2eYm+s+MnUEMxFdGIUCz5kOteuNqYZxaDmFagpQ== +"@sentry/core@6.19.2": + version "6.19.2" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.19.2.tgz#dd35ba6ca41a2dd011c43f732bcdadbb52c06376" + integrity sha512-yu1R3ewBT4udmB4v7sc4biQZ0Z0rfB9+TzB5ZKoCftbe6kqXjFMMaFRYNUF9HicVldKAsBktgkWw3+yfqGkw/A== dependencies: - "@sentry/hub" "6.17.9" - "@sentry/minimal" "6.17.9" - "@sentry/types" "6.17.9" - "@sentry/utils" "6.17.9" + "@sentry/hub" "6.19.2" + "@sentry/minimal" "6.19.2" + "@sentry/types" "6.19.2" + "@sentry/utils" "6.19.2" tslib "^1.9.3" -"@sentry/hub@6.17.9": - version "6.17.9" - resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.17.9.tgz#f2c355088a49045e49feafb5356ca5d6e1e31d3c" - integrity sha512-34EdrweWDbBV9EzEFIXcO+JeoyQmKzQVJxpTKZoJA6PUwf2NrndaUdjlkDEtBEzjuLUTxhLxtOzEsYs1O6RVcg== +"@sentry/hub@6.19.2": + version "6.19.2" + resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.19.2.tgz#0e9f9c507e55d8396002f644b43ef27cc9ff1289" + integrity sha512-W7KCgNBgdBIMagOxy5J5KQPe+maYxSqfE8a5ncQ3R8BcZDQEKnkW/1FplNbfRLZqA/tL/ndKb7pTPqVtzsbARw== dependencies: - "@sentry/types" "6.17.9" - "@sentry/utils" "6.17.9" + "@sentry/types" "6.19.2" + "@sentry/utils" "6.19.2" tslib "^1.9.3" -"@sentry/integrations@6.17.9": - version "6.17.9" - resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-6.17.9.tgz#a5965f0edb3ac72c3d62809733e1e87940bf7304" - integrity sha512-5eWBYeUcwHBJSuHNRpBlazjZEnpKz5aS5HoXdL7VZX0WPZ5Ci1oRAWudJWqXLsYW7bcng75vLQowwOw77Ll0fg== +"@sentry/integrations@6.19.2": + version "6.19.2" + resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-6.19.2.tgz#d5abcab94ae23ada097eb454c269e9ab573e14bb" + integrity sha512-RjkZXPrtrM+lJVEa4OpZ9CYjJdkpPoWslEQzLMvbaRpURpHFqmABGtXRAnJRYKmy6h7/9q9sABcDgCD4OZw11g== dependencies: - "@sentry/types" "6.17.9" - "@sentry/utils" "6.17.9" + "@sentry/types" "6.19.2" + "@sentry/utils" "6.19.2" localforage "^1.8.1" tslib "^1.9.3" -"@sentry/minimal@6.17.9": - version "6.17.9" - resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.17.9.tgz#0edca978097b3f56463ede028395d40adbf2ae84" - integrity sha512-T3PMCHcKk6lkZq6zKgANrYJJxXBXKOe+ousV1Fas1rVBMv7dtKfsa4itqQHszcW9shusPDiaQKIJ4zRLE5LKmg== +"@sentry/minimal@6.19.2": + version "6.19.2" + resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.19.2.tgz#e748541e4adbc7e80a3b6ccaf01b631c17fc44b4" + integrity sha512-ClwxKm77iDHET7kpzv1JvzDx1er5DoNu+EUjst0kQzARIrXvu9xuZuE2/CnBWycQWqw8o3HoGoKz65uIhsUCzQ== dependencies: - "@sentry/hub" "6.17.9" - "@sentry/types" "6.17.9" + "@sentry/hub" "6.19.2" + "@sentry/types" "6.19.2" tslib "^1.9.3" -"@sentry/react@6.17.9": - version "6.17.9" - resolved "https://registry.yarnpkg.com/@sentry/react/-/react-6.17.9.tgz#2066e7badb48c8da6da5bd07a7746137feb74021" - integrity sha512-TYu9Yl+gsNHdt763Yh35rSHJenxXqHSfWA55bYHr8hXDWu0crI/3LDuZb1RONmCM712CaQA+M5tgApA8QbHS4Q== +"@sentry/react@6.19.2": + version "6.19.2" + resolved "https://registry.yarnpkg.com/@sentry/react/-/react-6.19.2.tgz#67760aed06d7e54a2e117cd9048ad19d573c78f1" + integrity sha512-6ffifcUWJegvC5iYJlXL3zBirR05F/i5nA7QaYSMERJqZpXuYhwNPySbuiNTajm64+HA1RbdQkiwrHE/Ur3f1w== dependencies: - "@sentry/browser" "6.17.9" - "@sentry/minimal" "6.17.9" - "@sentry/types" "6.17.9" - "@sentry/utils" "6.17.9" + "@sentry/browser" "6.19.2" + "@sentry/minimal" "6.19.2" + "@sentry/types" "6.19.2" + "@sentry/utils" "6.19.2" hoist-non-react-statics "^3.3.2" tslib "^1.9.3" -"@sentry/tracing@6.17.9": - version "6.17.9" - resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.17.9.tgz#d4a6d96d88f10c9cd496e5b32f44d6e67d4c5dc7" - integrity sha512-5Rb/OS4ryNJLvz2nv6wyjwhifjy6veqaF9ffLrwFYij/WDy7m62ASBblxgeiI3fbPLX0aBRFWIJAq1vko26+AQ== +"@sentry/tracing@6.19.2": + version "6.19.2" + resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.19.2.tgz#ed6ff1bc901c4d79ef97f77ed54ce58c650e4915" + integrity sha512-rGoPpP1JIAxdq5bzrww0XuNVr6yn7RN6/wUcaxf6CAvklKvDx+q28WTGlZLGTZ/3un8Rv6i1FZFZOXizgnVnrg== dependencies: - "@sentry/hub" "6.17.9" - "@sentry/minimal" "6.17.9" - "@sentry/types" "6.17.9" - "@sentry/utils" "6.17.9" + "@sentry/hub" "6.19.2" + "@sentry/minimal" "6.19.2" + "@sentry/types" "6.19.2" + "@sentry/utils" "6.19.2" tslib "^1.9.3" -"@sentry/types@6.17.9": - version "6.17.9" - resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.17.9.tgz#d579c33cde0301adaf8ff4762479ad017bf0dffa" - integrity sha512-xuulX6qUCL14ayEOh/h6FUIvZtsi1Bx34dSOaWDrjXUOJHJAM7214uiqW1GZxPJ13YuaUIubjTSfDmSQ9CBzTw== +"@sentry/types@6.19.2": + version "6.19.2" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.19.2.tgz#0219c9da21ed975951108b8541913b1966464435" + integrity sha512-XO5qmVBdTs+7PdCz7fAwn1afWxSnRE2KLBFg5/vOdKosPSSHsSHUURSkxiEZc2QsR+JpRB4AeQ26AkIRX38qTg== -"@sentry/typescript@^5.20.0": +"@sentry/typescript@^5.20.1": version "5.20.1" resolved "https://registry.yarnpkg.com/@sentry/typescript/-/typescript-5.20.1.tgz#84133b3b8152367c936dbd573afe9e7a80c5f442" integrity sha512-RX3552k9LTANNXs9TeE1KhKOD+jfmVGpq81LT568cYmzv+fVVK/m2pynuh7SoAGqrJHirurA/IVLpt3bpnA4pw== @@ -1261,12 +1262,12 @@ tslint-config-prettier "^1.18.0" tslint-consistent-codestyle "^1.15.1" -"@sentry/utils@6.17.9": - version "6.17.9" - resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.17.9.tgz#425fe9af4e2d6114c2e9aaede75ccb6ddf91fbda" - integrity sha512-4eo9Z3JlJCGlGrQRbtZWL+L9NnlUXgTbfK3Lk7oO8D1ev8R5b5+iE6tZHTvU5rQRcq6zu+POT+tK5u9oxc/rnQ== +"@sentry/utils@6.19.2": + version "6.19.2" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.19.2.tgz#995efb896c5159369509f4896c27a2d2ea9191f2" + integrity sha512-2DQQ2OJaxjtyxGq5FmMlqb6hptsqMs2xoBiVRMkTS/rvyTrk1oQdKZ8ePwjtgX3nJ728ni3IXIyXV+vfGp4EBw== dependencies: - "@sentry/types" "6.17.9" + "@sentry/types" "6.19.2" tslib "^1.9.3" "@sentry/wizard@^1.2.17": @@ -5333,6 +5334,13 @@ node-fetch@^2.0.0-alpha.8, node-fetch@^2.2.0, node-fetch@^2.6.0: resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== +node-fetch@^2.6.7: + version "2.6.7" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" + integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== + dependencies: + whatwg-url "^5.0.0" + node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" @@ -7047,6 +7055,11 @@ tr46@^1.0.1: dependencies: punycode "^2.1.0" +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= + ts-jest@^24.3.0: version "24.3.0" resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-24.3.0.tgz#b97814e3eab359ea840a1ac112deae68aa440869" @@ -7335,6 +7348,11 @@ wcwidth@^1.0.1: dependencies: defaults "^1.0.3" +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= + webidl-conversions@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" @@ -7357,6 +7375,14 @@ whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0: resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0= + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + whatwg-url@^6.4.1: version "6.5.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.5.0.tgz#f2df02bff176fd65070df74ad5ccbb5a199965a8" @@ -7387,7 +7413,7 @@ which@^1.2.9, which@^1.3.0: dependencies: isexe "^2.0.0" -which@^2.0.1: +which@^2.0.1, which@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==