mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 08:32:09 +01:00
Migrate tests from Jest to Vitest, updating setup and test files accordingly.
- Replace Jest imports and mocks with Vitest equivalents in setup and unit tests. - Adjust test cases to use async imports and reset modules with Vitest. - Add Vitest configuration file for test environment setup and coverage reporting.
This commit is contained in:
@ -1,25 +1,19 @@
|
||||
// Jest test setup
|
||||
import { jest } from '@jest/globals';
|
||||
// Vitest test setup
|
||||
import { vi } from 'vitest';
|
||||
|
||||
// Mock console methods to reduce noise in tests
|
||||
global.console = {
|
||||
...console,
|
||||
log: jest.fn(),
|
||||
warn: jest.fn(),
|
||||
error: jest.fn(),
|
||||
log: vi.fn(),
|
||||
warn: vi.fn(),
|
||||
error: vi.fn(),
|
||||
};
|
||||
|
||||
// Set test environment variables
|
||||
Object.defineProperty(process.env, 'NODE_ENV', {
|
||||
value: 'test',
|
||||
writable: true,
|
||||
configurable: true,
|
||||
});
|
||||
process.env.NEXTAUTH_SECRET = 'test-secret';
|
||||
process.env.NEXTAUTH_URL = 'http://localhost:3000';
|
||||
|
||||
// Mock node-fetch for transcript fetcher tests
|
||||
jest.mock('node-fetch', () => ({
|
||||
__esModule: true,
|
||||
default: jest.fn(),
|
||||
vi.mock('node-fetch', () => ({
|
||||
default: vi.fn(),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user