Fix mock set resolution for folder-based organization #39
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.
Mock sets were not resolving when organized by folder structure (e.g.,
parameter/get___set1.json). Two bugs inlib/mock.js:Path parsing used wrong separator
path.delimiter(:or;for PATH env var) instead ofpath.sep(/or\)Set name regex captured leading underscores
/__(\w-]+?)$/matched\wwhich includes_get___set1.json: matched___set1, captured_set1(wrong), left basename asget(missing trailing_)/__([a-z\d][\w-]*)$/ito require first char after__be alphanumericget___set1.json: now matches__set1, capturesset1, leaves basename asget_(correct)Users can now organize mocks:
Where
get_is the method prefix, folder provides the path, and__setnameis the set suffix.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.