fix: improve Windows compatibility in tests#646
Conversation
- Replace Unix 'cat' command with fs.readFile in spec.test.ts - Replace 'mkdir -p' and 'bash' commands with fs.mkdir/writeFile in validate.enriched-output.test.ts - Skip symlink test on Windows (requires admin privileges) in file-system.test.ts
📝 WalkthroughWalkthroughThis pull request converts synchronous file operations in test files to asynchronous ones using Promise-based APIs and adds a Windows platform-specific skip condition to a symbolic link test. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review CompleteYour review story is ready! Comment !reviewfast on this PR to re-generate the story. |
Greptile OverviewGreptile SummaryImproved Windows compatibility in test suite by replacing Unix-specific shell commands with cross-platform Node.js filesystem APIs.
All changes maintain test functionality while ensuring cross-platform compatibility. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Test as Test Suite
participant FS as fs.promises
participant OS as Operating System
Note over Test,OS: spec.test.ts (file reading)
Test->>FS: readFile(path, 'utf-8')
FS->>OS: Read file content
OS-->>FS: File content
FS-->>Test: UTF-8 string
Note over Test,OS: validate.enriched-output.test.ts (file creation)
Test->>FS: mkdir(changePath, {recursive: true})
FS->>OS: Create directory
OS-->>FS: Success
FS-->>Test: Directory created
Test->>FS: writeFile(filePath, content)
FS->>OS: Write file
OS-->>FS: Success
FS-->>Test: File written
Note over Test,OS: file-system.test.ts (Windows check)
Test->>Test: Check process.platform === 'win32'
alt Windows platform
Test->>Test: Skip symlink test
else Non-Windows
Test->>FS: symlink(target, link)
FS->>OS: Create symbolic link
OS-->>FS: Success
FS-->>Test: Symlink created
end
|
Replace Unix 'cat' command with fs.readFile in spec.test.ts
Replace 'mkdir -p' and 'bash' commands with fs.mkdir/writeFile in validate.enriched-output.test.ts
Skip symlink test on Windows (requires admin privileges) in file-system.test.ts
Summary by CodeRabbit