Skip to content

Commit

Permalink
test(replay-canvas): Switch to using vitest (#12964)
Browse files Browse the repository at this point in the history
Before: `Time:        2.026 s`

After: `Duration 960ms (transform 291ms, setup 0ms, collect 446ms, tests
5ms, environment 283ms, prepare 65ms)`

Also:

- removes unused `@babel/core` dev dep
- removes unused eslintrc logic
  • Loading branch information
AbhiPrasad authored Jul 17, 2024
1 parent b4272be commit d70182e
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 27 deletions.
14 changes: 0 additions & 14 deletions packages/replay-canvas/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,4 @@

module.exports = {
extends: ['../../.eslintrc.js'],
overrides: [
{
files: ['src/**/*.ts'],
},
{
files: ['jest.setup.ts', 'jest.config.ts'],
parserOptions: {
project: ['tsconfig.test.json'],
},
rules: {
'no-console': 'off',
},
},
],
};
6 changes: 0 additions & 6 deletions packages/replay-canvas/jest.config.js

This file was deleted.

5 changes: 2 additions & 3 deletions packages/replay-canvas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
"clean": "rimraf build sentry-replay-*.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"
},
"publishConfig": {
Expand All @@ -65,7 +65,6 @@
},
"homepage": "https://docs.sentry.io/platforms/javascript/session-replay/",
"devDependencies": {
"@babel/core": "^7.17.5",
"@sentry-internal/rrweb": "2.25.0"
},
"dependencies": {
Expand Down
10 changes: 8 additions & 2 deletions packages/replay-canvas/test/canvas.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
/**
* @vitest-environment jsdom
*/

import { beforeEach, expect, it, vi } from 'vitest';

import { CanvasManager } from '@sentry-internal/rrweb';
import { _replayCanvasIntegration, replayCanvasIntegration } from '../src/canvas';

jest.mock('@sentry-internal/rrweb');
vi.mock('@sentry-internal/rrweb');

beforeEach(() => {
jest.clearAllMocks();
vi.clearAllMocks();
});

it('initializes with default options', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/replay-canvas/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"extends": "./tsconfig.json",

"include": ["test/**/*.ts", "jest.config.ts", "jest.setup.ts"],
"include": ["test/**/*.ts", "vite.config.ts"],

"compilerOptions": {
"lib": ["DOM", "ES2018"],
"types": ["node", "jest"],
"types": ["node"],
"esModuleInterop": true,
"allowJs": true,
"noImplicitAny": true,
Expand Down
5 changes: 5 additions & 0 deletions packages/replay-canvas/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import baseConfig from '../../vite/vite.config';

export default {
...baseConfig,
};

0 comments on commit d70182e

Please sign in to comment.