📝 Description
In src/__tests__/version-check.test.ts, the mocked implementation of readFileSync uses path.endsWith(...) to validate file paths. These checks assume POSIX-style forward-slash (/) directory separators.
Because Windows uses backslashes (\) for file paths, the .endsWith() suffix matches fail when running the test suite on Windows environments, causing tests to break unexpectedly.
📍 Location
- File:
src/__tests__/version-check.test.ts
- Affected Lines: ~113–115 (Also applies to lines 125–126, 136–140, and 150–154)
💥 Current Code Snippet
vi.mocked(readFileSync).mockImplementation((path) => {
if (typeof path === 'string' && path.endsWith('src/package.json')) {
return JSON.stringify({ version: '2.3.4' });
}
throw new Error('File not found');
});
📝 Description
In
src/__tests__/version-check.test.ts, the mocked implementation ofreadFileSyncusespath.endsWith(...)to validate file paths. These checks assume POSIX-style forward-slash (/) directory separators.Because Windows uses backslashes (
\) for file paths, the.endsWith()suffix matches fail when running the test suite on Windows environments, causing tests to break unexpectedly.📍 Location
src/__tests__/version-check.test.ts💥 Current Code Snippet