mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-10-23 06:12:23 +00:00
feat: Use Vitest for testing (#25284)
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
This commit is contained in:
1 parent
5d059b7bcb
commit
06f44533af
51 files changed
+2606
-4771
No files matched your search
+10
-4
@@ -290,10 +290,16 @@ export function read(): ReturnType<typeof yaml.read> {
|
||||
return yaml.read(path.join(mockDir, 'configuration.yaml'));
|
||||
}
|
||||
|
||||
jest.mock('../../lib/util/data', () => ({
|
||||
joinPath: (file: string): string => jest.requireActual('node:path').join(mockDir, file),
|
||||
getPath: (): string => mockDir,
|
||||
}));
|
||||
vi.mock('../../lib/util/data', async () => {
|
||||
const nodePath = await vi.importActual<typeof import('node:path')>('node:path');
|
||||
|
||||
return {
|
||||
default: {
|
||||
joinPath: (file: string): string => nodePath.join(mockDir, file),
|
||||
getPath: (): string => mockDir,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
writeDefaultConfiguration();
|
||||
writeDefaultState();
|
||||
Reference in new issue
Block a user