diff --git a/packages/react/jest.config.js b/packages/react/jest.config.js
deleted file mode 100644
index dec1faaf62e6..000000000000
--- a/packages/react/jest.config.js
+++ /dev/null
@@ -1,8 +0,0 @@
-const baseConfig = require('../../jest/jest.config.js');
-
-module.exports = {
- ...baseConfig,
- testEnvironment: 'jsdom',
- // We have some tests that trigger warnings, which mess up the test logs
- silent: true,
-};
diff --git a/packages/react/package.json b/packages/react/package.json
index 1efca9415ea2..fa1d436be43a 100644
--- a/packages/react/package.json
+++ b/packages/react/package.json
@@ -85,8 +85,8 @@
"clean": "rimraf build coverage sentry-react-*.tgz",
"fix": "eslint . --format stylish --fix",
"lint": "eslint . --format stylish",
- "test": "jest",
- "test:watch": "jest --watch",
+ "test": "vitest run",
+ "test:watch": "vitest --watch",
"yalc:publish": "yalc publish --push --sig"
},
"volta": {
diff --git a/packages/react/test/error.test.ts b/packages/react/test/error.test.ts
index 780c6f9657fb..8fb3cb09160b 100644
--- a/packages/react/test/error.test.ts
+++ b/packages/react/test/error.test.ts
@@ -1,3 +1,5 @@
+import { describe, expect, test } from 'vitest';
+
import { isAtLeastReact17 } from '../src/error';
describe('isAtLeastReact17', () => {
diff --git a/packages/react/test/errorboundary.test.tsx b/packages/react/test/errorboundary.test.tsx
index 81f276255a96..c320bcbe353d 100644
--- a/packages/react/test/errorboundary.test.tsx
+++ b/packages/react/test/errorboundary.test.tsx
@@ -1,3 +1,8 @@
+/**
+ * @vitest-environment jsdom
+ */
+import { afterEach, describe, expect, it, vi } from 'vitest';
+
import { Scope, getClient, setCurrentClient } from '@sentry/browser';
import type { Client } from '@sentry/core';
import { fireEvent, render, screen } from '@testing-library/react';
@@ -7,15 +12,14 @@ import { useState } from 'react';
import type { ErrorBoundaryProps, FallbackRender } from '../src/errorboundary';
import { ErrorBoundary, UNKNOWN_COMPONENT, withErrorBoundary } from '../src/errorboundary';
-const mockCaptureException = jest.fn();
-const mockShowReportDialog = jest.fn();
-const mockClientOn = jest.fn();
+const mockCaptureException = vi.fn();
+const mockShowReportDialog = vi.fn();
+const mockClientOn = vi.fn();
const EVENT_ID = 'test-id-123';
-jest.mock('@sentry/browser', () => {
- const actual = jest.requireActual('@sentry/browser');
+vi.mock('@sentry/browser', async requireActual => {
return {
- ...actual,
+ ...(await requireActual()),
captureException: (...args: unknown[]) => {
mockCaptureException(...args);
return EVENT_ID;
@@ -92,7 +96,7 @@ describe('withErrorBoundary', () => {
});
describe('ErrorBoundary', () => {
- jest.spyOn(console, 'error').mockImplementation();
+ vi.spyOn(console, 'error').mockImplementation(() => {});
afterEach(() => {
mockCaptureException.mockClear();
@@ -141,7 +145,7 @@ describe('ErrorBoundary', () => {
});
it('calls `onMount` when mounted', () => {
- const mockOnMount = jest.fn();
+ const mockOnMount = vi.fn();
render(
Error Component} onMount={mockOnMount}>
children
@@ -152,7 +156,7 @@ describe('ErrorBoundary', () => {
});
it('calls `onUnmount` when unmounted', () => {
- const mockOnUnmount = jest.fn();
+ const mockOnUnmount = vi.fn();
const { unmount } = render(
Error Component} onUnmount={mockOnUnmount}>
children
@@ -243,7 +247,7 @@ describe('ErrorBoundary', () => {
describe('error', () => {
it('calls `componentDidCatch() when an error occurs`', () => {
- const mockOnError = jest.fn();
+ const mockOnError = vi.fn();
render(
You have hit an error
} onError={mockOnError}>
children
@@ -267,12 +271,14 @@ describe('ErrorBoundary', () => {
mechanism: { handled: true },
});
- expect(mockOnError.mock.calls[0][0]).toEqual(mockCaptureException.mock.calls[0][0]);
+ expect(mockOnError.mock.calls[0]?.[0]).toEqual(mockCaptureException.mock.calls[0]?.[0]);
// Check if error.cause -> react component stack
- const error = mockCaptureException.mock.calls[0][0];
+ const error = mockCaptureException.mock.calls[0]?.[0];
const cause = error.cause;
- expect(cause.stack).toEqual(mockCaptureException.mock.calls[0][1]?.captureContext.contexts.react.componentStack);
+ expect(cause.stack).toEqual(
+ mockCaptureException.mock.calls[0]?.[1]?.captureContext.contexts.react.componentStack,
+ );
expect(cause.name).toContain('React ErrorBoundary');
expect(cause.message).toEqual(error.message);
});
@@ -326,12 +332,12 @@ describe('ErrorBoundary', () => {
});
// Check if error.cause -> react component stack
- const error = mockCaptureException.mock.calls[0][0];
+ const error = mockCaptureException.mock.calls[0]?.[0];
expect(error.cause).not.toBeDefined();
});
it('handles when `error.cause` is nested', () => {
- const mockOnError = jest.fn();
+ const mockOnError = vi.fn();
function CustomBam(): JSX.Element {
const firstError = new Error('bam');
@@ -364,19 +370,21 @@ describe('ErrorBoundary', () => {
mechanism: { handled: true },
});
- expect(mockOnError.mock.calls[0][0]).toEqual(mockCaptureException.mock.calls[0][0]);
+ expect(mockOnError.mock.calls[0]?.[0]).toEqual(mockCaptureException.mock.calls[0]?.[0]);
- const thirdError = mockCaptureException.mock.calls[0][0];
+ const thirdError = mockCaptureException.mock.calls[0]?.[0];
const secondError = thirdError.cause;
const firstError = secondError.cause;
const cause = firstError.cause;
- expect(cause.stack).toEqual(mockCaptureException.mock.calls[0][1]?.captureContext.contexts.react.componentStack);
+ expect(cause.stack).toEqual(
+ mockCaptureException.mock.calls[0]?.[1]?.captureContext.contexts.react.componentStack,
+ );
expect(cause.name).toContain('React ErrorBoundary');
expect(cause.message).toEqual(thirdError.message);
});
it('handles when `error.cause` is recursive', () => {
- const mockOnError = jest.fn();
+ const mockOnError = vi.fn();
function CustomBam(): JSX.Element {
const firstError = new Error('bam');
@@ -408,19 +416,19 @@ describe('ErrorBoundary', () => {
mechanism: { handled: true },
});
- expect(mockOnError.mock.calls[0][0]).toEqual(mockCaptureException.mock.calls[0][0]);
+ expect(mockOnError.mock.calls[0]?.[0]).toEqual(mockCaptureException.mock.calls[0]?.[0]);
- const error = mockCaptureException.mock.calls[0][0];
+ const error = mockCaptureException.mock.calls[0]?.[0];
const cause = error.cause;
// We need to make sure that recursive error.cause does not cause infinite loop
expect(cause.stack).not.toEqual(
- mockCaptureException.mock.calls[0][1]?.captureContext.contexts.react.componentStack,
+ mockCaptureException.mock.calls[0]?.[1]?.captureContext.contexts.react.componentStack,
);
expect(cause.name).not.toContain('React ErrorBoundary');
});
it('calls `beforeCapture()` when an error occurs', () => {
- const mockBeforeCapture = jest.fn();
+ const mockBeforeCapture = vi.fn();
const testBeforeCapture = (...args: any[]) => {
expect(mockCaptureException).toHaveBeenCalledTimes(0);
@@ -516,7 +524,7 @@ describe('ErrorBoundary', () => {
});
it('calls `onReset()` when reset', () => {
- const mockOnReset = jest.fn();
+ const mockOnReset = vi.fn();
render(
({ ...spanArgs }));
-const mockFinish = jest.fn();
+const mockStartInactiveSpan = vi.fn((spanArgs: StartSpanOptions) => ({ ...spanArgs }));
+const mockFinish = vi.fn();
class MockSpan extends SentrySpan {
public end(): void {
@@ -19,8 +23,8 @@ class MockSpan extends SentrySpan {
let activeSpan: Record;
-jest.mock('@sentry/browser', () => ({
- ...jest.requireActual('@sentry/browser'),
+vi.mock('@sentry/browser', async requireActual => ({
+ ...(await requireActual()),
getActiveSpan: () => activeSpan,
startInactiveSpan: (ctx: StartSpanOptions) => {
mockStartInactiveSpan(ctx);
diff --git a/packages/react/test/reactrouter-descendant-routes.test.tsx b/packages/react/test/reactrouter-descendant-routes.test.tsx
index dcc73a2275df..ff89ae86f639 100644
--- a/packages/react/test/reactrouter-descendant-routes.test.tsx
+++ b/packages/react/test/reactrouter-descendant-routes.test.tsx
@@ -1,3 +1,8 @@
+/**
+ * @vitest-environment jsdom
+ */
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
import {
SEMANTIC_ATTRIBUTE_SENTRY_OP,
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
@@ -28,19 +33,19 @@ import {
wrapUseRoutesV6,
} from '../src/reactrouterv6';
-const mockStartBrowserTracingPageLoadSpan = jest.fn();
-const mockStartBrowserTracingNavigationSpan = jest.fn();
+const mockStartBrowserTracingPageLoadSpan = vi.fn();
+const mockStartBrowserTracingNavigationSpan = vi.fn();
const mockRootSpan = {
- updateName: jest.fn(),
- setAttribute: jest.fn(),
+ updateName: vi.fn(),
+ setAttribute: vi.fn(),
getSpanJSON() {
return { op: 'pageload' };
},
};
-jest.mock('@sentry/browser', () => {
- const actual = jest.requireActual('@sentry/browser');
+vi.mock('@sentry/browser', async requireActual => {
+ const actual = (await requireActual()) as any;
return {
...actual,
startBrowserTracingNavigationSpan: (...args: unknown[]) => {
@@ -54,10 +59,9 @@ jest.mock('@sentry/browser', () => {
};
});
-jest.mock('@sentry/core', () => {
- const actual = jest.requireActual('@sentry/core');
+vi.mock('@sentry/core', async requireActual => {
return {
- ...actual,
+ ...(await requireActual()),
getRootSpan: () => {
return mockRootSpan;
},
@@ -75,7 +79,7 @@ describe('React Router Descendant Routes', () => {
}
beforeEach(() => {
- jest.clearAllMocks();
+ vi.clearAllMocks();
getCurrentScope().setClient(undefined);
});
diff --git a/packages/react/test/reactrouterv3.test.tsx b/packages/react/test/reactrouterv3.test.tsx
index cf8995630e71..9802871740c1 100644
--- a/packages/react/test/reactrouterv3.test.tsx
+++ b/packages/react/test/reactrouterv3.test.tsx
@@ -1,3 +1,8 @@
+/**
+ * @vitest-environment jsdom
+ */
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
import { BrowserClient } from '@sentry/browser';
import {
SEMANTIC_ATTRIBUTE_SENTRY_OP,
@@ -13,18 +18,18 @@ import * as React from 'react';
import { IndexRoute, Route, Router, createMemoryHistory, createRoutes, match } from 'react-router-3';
import { reactRouterV3BrowserTracingIntegration } from '../src/reactrouterv3';
-const mockStartBrowserTracingPageLoadSpan = jest.fn();
-const mockStartBrowserTracingNavigationSpan = jest.fn();
+const mockStartBrowserTracingPageLoadSpan = vi.fn();
+const mockStartBrowserTracingNavigationSpan = vi.fn();
const mockRootSpan = {
- setAttribute: jest.fn(),
+ setAttribute: vi.fn(),
getSpanJSON() {
return { op: 'pageload' };
},
};
-jest.mock('@sentry/browser', () => {
- const actual = jest.requireActual('@sentry/browser');
+vi.mock('@sentry/browser', async requireActual => {
+ const actual = (await requireActual()) as any;
return {
...actual,
startBrowserTracingNavigationSpan: (...args: unknown[]) => {
@@ -38,10 +43,9 @@ jest.mock('@sentry/browser', () => {
};
});
-jest.mock('@sentry/core', () => {
- const actual = jest.requireActual('@sentry/core');
+vi.mock('@sentry/core', async requireActual => {
return {
- ...actual,
+ ...(await requireActual()),
getRootSpan: () => {
return mockRootSpan;
},
@@ -78,7 +82,7 @@ describe('browserTracingReactRouterV3', () => {
}
beforeEach(() => {
- jest.clearAllMocks();
+ vi.clearAllMocks();
getCurrentScope().setClient(undefined);
});
diff --git a/packages/react/test/reactrouterv4.test.tsx b/packages/react/test/reactrouterv4.test.tsx
index cb479ed57d83..f1de1829b615 100644
--- a/packages/react/test/reactrouterv4.test.tsx
+++ b/packages/react/test/reactrouterv4.test.tsx
@@ -1,3 +1,8 @@
+/**
+ * @vitest-environment jsdom
+ */
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
import {
SEMANTIC_ATTRIBUTE_SENTRY_OP,
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
@@ -15,19 +20,19 @@ import { Route, Router, Switch, matchPath } from 'react-router-4';
import { BrowserClient, reactRouterV4BrowserTracingIntegration, withSentryRouting } from '../src';
import type { RouteConfig } from '../src/reactrouter';
-const mockStartBrowserTracingPageLoadSpan = jest.fn();
-const mockStartBrowserTracingNavigationSpan = jest.fn();
+const mockStartBrowserTracingPageLoadSpan = vi.fn();
+const mockStartBrowserTracingNavigationSpan = vi.fn();
const mockRootSpan = {
- updateName: jest.fn(),
- setAttribute: jest.fn(),
+ updateName: vi.fn(),
+ setAttribute: vi.fn(),
getSpanJSON() {
return { op: 'pageload' };
},
};
-jest.mock('@sentry/browser', () => {
- const actual = jest.requireActual('@sentry/browser');
+vi.mock('@sentry/browser', async requireActual => {
+ const actual = (await requireActual()) as any;
return {
...actual,
startBrowserTracingNavigationSpan: (...args: unknown[]) => {
@@ -41,10 +46,9 @@ jest.mock('@sentry/browser', () => {
};
});
-jest.mock('@sentry/core', () => {
- const actual = jest.requireActual('@sentry/core');
+vi.mock('@sentry/core', async requireActual => {
return {
- ...actual,
+ ...(await requireActual()),
getRootSpan: () => {
return mockRootSpan;
},
@@ -62,7 +66,7 @@ describe('browserTracingReactRouterV4', () => {
}
beforeEach(() => {
- jest.clearAllMocks();
+ vi.clearAllMocks();
getCurrentScope().setClient(undefined);
});
diff --git a/packages/react/test/reactrouterv5.test.tsx b/packages/react/test/reactrouterv5.test.tsx
index 45271fea7bee..368d33fd149e 100644
--- a/packages/react/test/reactrouterv5.test.tsx
+++ b/packages/react/test/reactrouterv5.test.tsx
@@ -1,3 +1,8 @@
+/**
+ * @vitest-environment jsdom
+ */
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
import {
SEMANTIC_ATTRIBUTE_SENTRY_OP,
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
@@ -15,19 +20,19 @@ import { Route, Router, Switch, matchPath } from 'react-router-5';
import { BrowserClient, reactRouterV5BrowserTracingIntegration, withSentryRouting } from '../src';
import type { RouteConfig } from '../src/reactrouter';
-const mockStartBrowserTracingPageLoadSpan = jest.fn();
-const mockStartBrowserTracingNavigationSpan = jest.fn();
+const mockStartBrowserTracingPageLoadSpan = vi.fn();
+const mockStartBrowserTracingNavigationSpan = vi.fn();
const mockRootSpan = {
- updateName: jest.fn(),
- setAttribute: jest.fn(),
+ updateName: vi.fn(),
+ setAttribute: vi.fn(),
getSpanJSON() {
return { op: 'pageload' };
},
};
-jest.mock('@sentry/browser', () => {
- const actual = jest.requireActual('@sentry/browser');
+vi.mock('@sentry/browser', async requireActual => {
+ const actual = (await requireActual()) as any;
return {
...actual,
startBrowserTracingNavigationSpan: (...args: unknown[]) => {
@@ -41,10 +46,9 @@ jest.mock('@sentry/browser', () => {
};
});
-jest.mock('@sentry/core', () => {
- const actual = jest.requireActual('@sentry/core');
+vi.mock('@sentry/core', async requireActual => {
return {
- ...actual,
+ ...(await requireActual()),
getRootSpan: () => {
return mockRootSpan;
},
@@ -62,7 +66,7 @@ describe('browserTracingReactRouterV5', () => {
}
beforeEach(() => {
- jest.clearAllMocks();
+ vi.clearAllMocks();
getCurrentScope().setClient(undefined);
});
diff --git a/packages/react/test/reactrouterv6-compat-utils.test.tsx b/packages/react/test/reactrouterv6-compat-utils.test.tsx
index 2bbe1ec7e52c..ee07da4dafe1 100644
--- a/packages/react/test/reactrouterv6-compat-utils.test.tsx
+++ b/packages/react/test/reactrouterv6-compat-utils.test.tsx
@@ -1,3 +1,5 @@
+import { describe, expect } from 'vitest';
+
import { getNumberOfUrlSegments } from '../src/reactrouterv6-compat-utils';
describe('getNumberOfUrlSegments', () => {
diff --git a/packages/react/test/reactrouterv6.test.tsx b/packages/react/test/reactrouterv6.test.tsx
index 879abf15d2d0..77777e527a9b 100644
--- a/packages/react/test/reactrouterv6.test.tsx
+++ b/packages/react/test/reactrouterv6.test.tsx
@@ -1,3 +1,8 @@
+/**
+ * @vitest-environment jsdom
+ */
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
import {
SEMANTIC_ATTRIBUTE_SENTRY_OP,
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
@@ -33,19 +38,19 @@ import {
wrapUseRoutesV6,
} from '../src/reactrouterv6';
-const mockStartBrowserTracingPageLoadSpan = jest.fn();
-const mockStartBrowserTracingNavigationSpan = jest.fn();
+const mockStartBrowserTracingPageLoadSpan = vi.fn();
+const mockStartBrowserTracingNavigationSpan = vi.fn();
const mockRootSpan = {
- updateName: jest.fn(),
- setAttribute: jest.fn(),
+ updateName: vi.fn(),
+ setAttribute: vi.fn(),
getSpanJSON() {
return { op: 'pageload' };
},
};
-jest.mock('@sentry/browser', () => {
- const actual = jest.requireActual('@sentry/browser');
+vi.mock('@sentry/browser', async requireActual => {
+ const actual = (await requireActual()) as any;
return {
...actual,
startBrowserTracingNavigationSpan: (...args: unknown[]) => {
@@ -59,10 +64,9 @@ jest.mock('@sentry/browser', () => {
};
});
-jest.mock('@sentry/core', () => {
- const actual = jest.requireActual('@sentry/core');
+vi.mock('@sentry/core', async requireActual => {
return {
- ...actual,
+ ...(await requireActual()),
getRootSpan: () => {
return mockRootSpan;
},
@@ -80,7 +84,7 @@ describe('reactRouterV6BrowserTracingIntegration', () => {
}
beforeEach(() => {
- jest.clearAllMocks();
+ vi.clearAllMocks();
getCurrentScope().setClient(undefined);
});
diff --git a/packages/react/test/redux.test.ts b/packages/react/test/redux.test.ts
index 50116c8db87e..b08e8a0061bc 100644
--- a/packages/react/test/redux.test.ts
+++ b/packages/react/test/redux.test.ts
@@ -1,14 +1,17 @@
+import type { Mock } from 'vitest';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
import * as Sentry from '@sentry/browser';
import * as SentryCore from '@sentry/core';
import * as Redux from 'redux';
import { createReduxEnhancer } from '../src/redux';
-const mockSetContext = jest.fn();
-const mockGlobalScopeAddEventProcessor = jest.fn();
+const mockSetContext = vi.fn();
+const mockGlobalScopeAddEventProcessor = vi.fn();
-jest.mock('@sentry/core', () => ({
- ...jest.requireActual('@sentry/core'),
+vi.mock('@sentry/core', async requireActual => ({
+ ...(await requireActual()),
getCurrentScope() {
return {
setContext: mockSetContext,
@@ -19,8 +22,8 @@ jest.mock('@sentry/core', () => ({
addEventProcessor: mockGlobalScopeAddEventProcessor,
};
},
- addEventProcessor: jest.fn(),
- addBreadcrumb: jest.fn(),
+ addEventProcessor: vi.fn(),
+ addBreadcrumb: vi.fn(),
}));
afterEach(() => {
@@ -29,10 +32,10 @@ afterEach(() => {
});
describe('createReduxEnhancer', () => {
- let mockAddBreadcrumb: jest.SpyInstance;
+ let mockAddBreadcrumb: Mock;
beforeEach(() => {
- mockAddBreadcrumb = SentryCore.addBreadcrumb as unknown as jest.SpyInstance;
+ mockAddBreadcrumb = SentryCore.addBreadcrumb as unknown as Mock;
mockAddBreadcrumb.mockReset();
});
@@ -221,7 +224,7 @@ describe('createReduxEnhancer', () => {
});
it('configureScopeWithState is passed latest state', () => {
- const configureScopeWithState = jest.fn();
+ const configureScopeWithState = vi.fn();
const enhancer = createReduxEnhancer({
configureScopeWithState,
});
@@ -269,7 +272,7 @@ describe('createReduxEnhancer', () => {
expect(mockGlobalScopeAddEventProcessor).toHaveBeenCalledTimes(1);
- const callbackFunction = mockGlobalScopeAddEventProcessor.mock.calls[0][0];
+ const callbackFunction = mockGlobalScopeAddEventProcessor.mock.calls[0]?.[0];
const mockEvent = {
contexts: {
@@ -330,7 +333,7 @@ describe('createReduxEnhancer', () => {
expect(mockGlobalScopeAddEventProcessor).toHaveBeenCalledTimes(1);
- const callbackFunction = mockGlobalScopeAddEventProcessor.mock.calls[0][0];
+ const callbackFunction = mockGlobalScopeAddEventProcessor.mock.calls[0]?.[0];
const mockEvent = {
contexts: {
@@ -365,7 +368,7 @@ describe('createReduxEnhancer', () => {
expect(mockGlobalScopeAddEventProcessor).toHaveBeenCalledTimes(1);
- const callbackFunction = mockGlobalScopeAddEventProcessor.mock.calls[0][0];
+ const callbackFunction = mockGlobalScopeAddEventProcessor.mock.calls[0]?.[0];
const mockEvent = {
contexts: {
@@ -397,7 +400,7 @@ describe('createReduxEnhancer', () => {
expect(mockGlobalScopeAddEventProcessor).toHaveBeenCalledTimes(1);
- const callbackFunction = mockGlobalScopeAddEventProcessor.mock.calls[0][0];
+ const callbackFunction = mockGlobalScopeAddEventProcessor.mock.calls[0]?.[0];
const mockEvent = {
type: 'not_redux',
diff --git a/packages/react/test/sdk.test.ts b/packages/react/test/sdk.test.ts
index 825ade6f0b25..fde2c71b2797 100644
--- a/packages/react/test/sdk.test.ts
+++ b/packages/react/test/sdk.test.ts
@@ -1,17 +1,12 @@
+import { describe, expect, it, vi } from 'vitest';
+
import * as SentryBrowser from '@sentry/browser';
import { version } from 'react';
import { init } from '../src/sdk';
-jest.mock('@sentry/browser', () => {
- return {
- __esModule: true,
- ...jest.requireActual('@sentry/browser'),
- };
-});
-
describe('init', () => {
it('sets the React version (if available) in the global scope', () => {
- const setContextSpy = jest.spyOn(SentryBrowser, 'setContext');
+ const setContextSpy = vi.spyOn(SentryBrowser, 'setContext');
init({});
diff --git a/packages/react/tsconfig.test.json b/packages/react/tsconfig.test.json
index af7e36ec0eda..00cada2d8bcf 100644
--- a/packages/react/tsconfig.test.json
+++ b/packages/react/tsconfig.test.json
@@ -1,12 +1,9 @@
{
"extends": "./tsconfig.json",
- "include": ["test/**/*"],
+ "include": ["test/**/*", "vite.config.ts"],
"compilerOptions": {
- // should include all types from `./tsconfig.json` plus types for all test frameworks used
- "types": ["jest"]
-
// other package-specific, test-specific options
}
}
diff --git a/packages/react/vite.config.ts b/packages/react/vite.config.ts
new file mode 100644
index 000000000000..a5523c61f601
--- /dev/null
+++ b/packages/react/vite.config.ts
@@ -0,0 +1,10 @@
+import { defineConfig } from 'vitest/config';
+
+import baseConfig from '../../vite/vite.config';
+
+export default defineConfig({
+ ...baseConfig,
+ test: {
+ ...baseConfig.test,
+ },
+});