Skip to content

Commit ef652a4

Browse files
committed
test(replay-canvas): Switch to using vitest
1 parent b4272be commit ef652a4

File tree

6 files changed

+17
-27
lines changed

6 files changed

+17
-27
lines changed

packages/replay-canvas/.eslintrc.js

-14
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,4 @@
55

66
module.exports = {
77
extends: ['../../.eslintrc.js'],
8-
overrides: [
9-
{
10-
files: ['src/**/*.ts'],
11-
},
12-
{
13-
files: ['jest.setup.ts', 'jest.config.ts'],
14-
parserOptions: {
15-
project: ['tsconfig.test.json'],
16-
},
17-
rules: {
18-
'no-console': 'off',
19-
},
20-
},
21-
],
228
};

packages/replay-canvas/jest.config.js

-6
This file was deleted.

packages/replay-canvas/package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
"clean": "rimraf build sentry-replay-*.tgz",
4848
"fix": "eslint . --format stylish --fix",
4949
"lint": "eslint . --format stylish",
50-
"test": "jest",
51-
"test:watch": "jest --watch",
50+
"test": "vitest run",
51+
"test:watch": "vitest --watch",
5252
"yalc:publish": "yalc publish --push --sig"
5353
},
5454
"publishConfig": {
@@ -65,7 +65,6 @@
6565
},
6666
"homepage": "https://docs.sentry.io/platforms/javascript/session-replay/",
6767
"devDependencies": {
68-
"@babel/core": "^7.17.5",
6968
"@sentry-internal/rrweb": "2.25.0"
7069
},
7170
"dependencies": {

packages/replay-canvas/test/canvas.test.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
/**
2+
* @vitest-environment jsdom
3+
*/
4+
5+
import { beforeEach, expect, it, vi } from 'vitest';
6+
17
import { CanvasManager } from '@sentry-internal/rrweb';
28
import { _replayCanvasIntegration, replayCanvasIntegration } from '../src/canvas';
39

4-
jest.mock('@sentry-internal/rrweb');
10+
vi.mock('@sentry-internal/rrweb');
511

612
beforeEach(() => {
7-
jest.clearAllMocks();
13+
vi.clearAllMocks();
814
});
915

1016
it('initializes with default options', () => {

packages/replay-canvas/tsconfig.test.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"extends": "./tsconfig.json",
33

4-
"include": ["test/**/*.ts", "jest.config.ts", "jest.setup.ts"],
4+
"include": ["test/**/*.ts", "vite.config.ts"],
55

66
"compilerOptions": {
77
"lib": ["DOM", "ES2018"],
8-
"types": ["node", "jest"],
8+
"types": ["node"],
99
"esModuleInterop": true,
1010
"allowJs": true,
1111
"noImplicitAny": true,

packages/replay-canvas/vite.config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import baseConfig from '../../vite/vite.config';
2+
3+
export default {
4+
...baseConfig,
5+
};

0 commit comments

Comments
 (0)