chore(internal): Use memfs for project.ts test#555
Merged
Conversation
✅ Deploy Preview for cedarjs canceled.
|
Contributor
Greptile OverviewGreptile SummaryRefactored test from using real filesystem fixtures to memfs virtual filesystem, but implementation has critical bugs that will cause tests to fail. Key Issues
Why This MattersThe test flow is: Reference implementation: Confidence Score: 0/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Test as Test Suite
participant Vitest as Vitest
participant Memfs as memfs (vol)
participant FS as fs/node:fs
participant GetTsConfigs as getTsConfigs()
participant GetPaths as getPaths()
participant GetConfigPath as getConfigPath()
participant FindUp as findUp()
Test->>Vitest: vi.mock('fs', memfs)
Test->>Vitest: vi.mock('node:fs', memfs)
Test->>Memfs: vol.fromNestedJSON({...}, '/')
Note over Memfs: Creates virtual filesystem at root
Test->>GetTsConfigs: Call getTsConfigs()
GetTsConfigs->>GetPaths: Call getPaths()
GetPaths->>GetConfigPath: Call getConfigPath()
Note over GetConfigPath: Uses process.env.RWJS_CWD ?? process.cwd()
Note over GetConfigPath,FindUp: ⚠️ BUG: RWJS_CWD not set,<br/>uses real filesystem cwd
GetConfigPath->>FindUp: findUp('redwood.toml', process.cwd())
FindUp->>FS: fs.existsSync(realCwd + '/redwood.toml')
Note over FS: Checks REAL filesystem,<br/>not memfs virtual filesystem
FS-->>FindUp: false (not found in real fs)
FindUp-->>GetConfigPath: null
GetConfigPath-->>GetPaths: throws Error
GetPaths-->>GetTsConfigs: Error propagates
GetTsConfigs-->>Test: ❌ Test fails
|
Tobbe
added a commit
that referenced
this pull request
Nov 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use memfs to mock the filesystem for faster tests, and to not rely on the global test fixtures