-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjest.setup.cjs
More file actions
38 lines (33 loc) · 1.06 KB
/
jest.setup.cjs
File metadata and controls
38 lines (33 loc) · 1.06 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
// Jest setup file for NetCDF4 WASM tests
// Mock the global NetCDF4Module function if not available
if (typeof global.NetCDF4Module === 'undefined') {
global.NetCDF4Module = jest.fn().mockRejectedValue(
new Error('NetCDF4Module not available in test environment')
);
}
// Mock Node.js modules for WASM module
jest.mock('path', () => ({
join: jest.fn((...args) => args.join('/'))
}));
jest.mock('fs', () => ({
existsSync: jest.fn(() => false),
mkdirSync: jest.fn(),
unlinkSync: jest.fn(),
rmdirSync: jest.fn(),
readdirSync: jest.fn(() => [])
}));
// Console warnings for missing WASM module are expected in tests
const originalWarn = console.warn;
console.warn = (...args) => {
if (args[0] && args[0].includes('WASM module not available')) {
// Suppress expected warnings in tests
return;
}
if (args[0] && args[0].includes('sync() not yet implemented')) {
// Suppress expected warnings about unimplemented features
return;
}
originalWarn.apply(console, args);
};
// Set longer timeout for integration tests
jest.setTimeout(30000);