-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.js
More file actions
38 lines (34 loc) · 1.02 KB
/
Copy pathjest.setup.js
File metadata and controls
38 lines (34 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import '@testing-library/jest-dom';
/**
* Setup global para Jest
* Este archivo se ejecuta antes de cada suite de tests
*/
// Mock de Web Animations API para tests
// La Web Animations API no está disponible en jsdom por defecto
if (!Element.prototype.animate) {
Element.prototype.animate = jest.fn(function (keyframes, options) {
return {
finished: Promise.resolve(),
cancel: jest.fn(),
play: jest.fn(),
pause: jest.fn(),
finish: jest.fn(),
reverse: jest.fn(),
currentTime: 0,
playbackRate: 1
};
});
}
// Mock de console.error para tests que esperan errores
const originalError = console.error;
beforeAll(() => {
console.error = jest.fn((...args) => {
// Solo mostrar errores que no sean esperados en tests
if (!args[0]?.includes('(WAVES)')) {
originalError(...args);
}
});
});
afterAll(() => {
console.error = originalError;
});