(...segments: string[])
| 13 | |
| 14 | // Helper function to create platform-agnostic test paths |
| 15 | function testPath(...segments: string[]): string { |
| 16 | // Start with the first segment as is (might be an absolute path on Windows) |
| 17 | let result = segments[0]; |
| 18 | |
| 19 | // Join remaining segments with the platform-specific separator |
| 20 | for (let i = 1; i < segments.length; i++) { |
| 21 | if (segments[i].startsWith('/') || segments[i].startsWith('\\')) { |
| 22 | // If segment starts with a separator, remove the trailing separator from the result |
| 23 | result = path.normalize(result.replace(/[\\/]+$/, '') + segments[i]); |
| 24 | } else { |
| 25 | // Otherwise join with the platform separator |
| 26 | result = path.join(result, segments[i]); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | return path.normalize(result); |
| 31 | } |
| 32 | |
| 33 | vi.mock('fs/promises'); |
| 34 | const mockedFs = vi.mocked(fs); |
no outgoing calls
no test coverage detected