Skip to content

Commit 01722c7

Browse files
committed
fix: resolve Windows test timeout in custom-system-prompt.spec.ts
- Replace toPosix() call with inline path normalization in mock implementation - Handle both string and Buffer types for filePath parameter - Normalize path separators to forward slashes for cross-platform compatibility - Fixes test timeout issue on Windows CI environment
1 parent 538f47b commit 01722c7

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/core/prompts/__tests__/custom-system-prompt.spec.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,11 @@ describe("File-Based Custom System Prompt", () => {
122122
const fileCustomSystemPrompt = "Custom system prompt from file"
123123
// When called with utf-8 encoding, return a string
124124
mockedFs.readFile.mockImplementation((filePath, options) => {
125-
if (
126-
filePath.toString().toPosix().includes(`.roo/system-prompt-${defaultModeSlug}`) &&
127-
options === "utf-8"
128-
) {
125+
// Convert filePath to string and normalize path separators
126+
const normalizedPath =
127+
typeof filePath === "string" ? filePath.replace(/\\/g, "/") : filePath.toString().replace(/\\/g, "/")
128+
129+
if (normalizedPath.includes(`.roo/system-prompt-${defaultModeSlug}`) && options === "utf-8") {
129130
return Promise.resolve(fileCustomSystemPrompt)
130131
}
131132
return Promise.reject({ code: "ENOENT" })
@@ -163,10 +164,11 @@ describe("File-Based Custom System Prompt", () => {
163164
// Mock the readFile to return content from a file
164165
const fileCustomSystemPrompt = "Custom system prompt from file"
165166
mockedFs.readFile.mockImplementation((filePath, options) => {
166-
if (
167-
filePath.toString().toPosix().includes(`.roo/system-prompt-${defaultModeSlug}`) &&
168-
options === "utf-8"
169-
) {
167+
// Convert filePath to string and normalize path separators
168+
const normalizedPath =
169+
typeof filePath === "string" ? filePath.replace(/\\/g, "/") : filePath.toString().replace(/\\/g, "/")
170+
171+
if (normalizedPath.includes(`.roo/system-prompt-${defaultModeSlug}`) && options === "utf-8") {
170172
return Promise.resolve(fileCustomSystemPrompt)
171173
}
172174
return Promise.reject({ code: "ENOENT" })

0 commit comments

Comments
 (0)