Skip to content

Commit

Permalink
setup of vitest (#3238)
Browse files Browse the repository at this point in the history
Signed-off-by: NishantSinghhhhh <nishantsingh_230137@aitpune.edu.in>
  • Loading branch information
NishantSinghhhhh authored Jan 10, 2025
1 parent d2e6829 commit ea2f4ea
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -1 +1,28 @@
import '@testing-library/jest-dom';
import { cleanup } from '@testing-library/react';

// Basic cleanup after each test
afterEach(() => {
cleanup();
});

// Simple console error handler for React 18 warnings
const originalError = console.error;
beforeAll(() => {
console.error = (...args: unknown[]) => {
const firstArg = args[0];
if (
typeof firstArg === 'string' &&
/Warning: ReactDOM.render is no longer supported in React 18./.test(
firstArg,
)
) {
return;
}
originalError.call(console, ...args);
};
});

afterAll(() => {
console.error = originalError;
});

0 comments on commit ea2f4ea

Please sign in to comment.