mirror of
https://github.com/LukeHagar/sveltekit-adapters.git
synced 2025-12-09 12:47:48 +00:00
chore: Bump version to 1.0.6 and update package.json for adapter-electron
- Added placeholders.d.ts to the files list. - Updated dependencies for electron and cookie. - Introduced new scripts for testing and type checking. - Adjusted devDependencies for compatibility with TypeScript and testing tools.
This commit is contained in:
35
packages/adapter-electron/tests/setup.js
Normal file
35
packages/adapter-electron/tests/setup.js
Normal file
@@ -0,0 +1,35 @@
|
||||
// Test setup file for vitest
|
||||
import { vi } from 'vitest';
|
||||
|
||||
// Mock __dirname for ES modules
|
||||
global.__dirname = process.cwd();
|
||||
|
||||
// Mock process.env defaults
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'test';
|
||||
|
||||
// Global test utilities
|
||||
global.mockElectronRequest = (overrides = {}) => ({
|
||||
url: 'http://127.0.0.1/test',
|
||||
method: 'GET',
|
||||
headers: new Map(),
|
||||
body: null,
|
||||
uploadData: [],
|
||||
...overrides
|
||||
});
|
||||
|
||||
global.mockElectronSession = (overrides = {}) => ({
|
||||
cookies: {
|
||||
get: vi.fn().mockResolvedValue([]),
|
||||
set: vi.fn().mockResolvedValue(),
|
||||
remove: vi.fn().mockResolvedValue()
|
||||
},
|
||||
...overrides
|
||||
});
|
||||
|
||||
// Suppress console.error in tests unless specifically testing error handling
|
||||
const originalConsoleError = console.error;
|
||||
console.error = (...args) => {
|
||||
if (process.env.VITEST_SHOW_ERRORS === 'true') {
|
||||
originalConsoleError(...args);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user