Skip to content

Conversation

Copy link

Copilot AI commented Feb 2, 2026

Mock sets were not resolving when organized by folder structure (e.g., parameter/get___set1.json). Two bugs in lib/mock.js:

Path parsing used wrong separator

  • Line 68 used path.delimiter (: or ; for PATH env var) instead of path.sep (/ or \)
  • Prevented folder components from being extracted

Set name regex captured leading underscores

  • Pattern /__(\w-]+?)$/ matched \w which includes _
  • For get___set1.json: matched ___set1, captured _set1 (wrong), left basename as get (missing trailing _)
  • Changed to /__([a-z\d][\w-]*)$/i to require first char after __ be alphanumeric
  • For get___set1.json: now matches __set1, captures set1, leaves basename as get_ (correct)

Users can now organize mocks:

parameter/
  get_.json         # default
  get___set1.json   # --set set1
  get___set2.json   # --set set2

Where get_ is the method prefix, folder provides the path, and __setname is the set suffix.

Original prompt

This section details on the original issue you should resolve

<issue_title>Mock sets don’t resolve when organizing by folder structure</issue_title>
<issue_description>Hi smoke maintainers,

We’re using mock sets to simulate different user roles. The documented filename suffix approach works as expected, e.g.:

get_parameter__set1.json

get_parameter__set2.json

According to the documentation, mock sets are selected via the __set-name suffix and smoke --set name.

What we tried:

For a clearer structure, we wanted to group mocks by “parameter” using folders and keep only the set name in the filename:

parameter/
  get___set1.json
  get___set2.json
  get___set3.json

Note: we tried it with 2 and 3 underscores, both don't work

Expected behavior

Smoke resolves these the same way as the flat structure (i.e., folder name doesn’t interfere with set selection), or there’s a supported convention for “set folders”.

Actual behavior

This does not work properly (the mocks are not selected / resolved as expected when running with --set set1, etc.), only the default get_.json file is used.

Question

Is this intended behavior (mock sets only supported via filename suffix), or is this a bug / missing feature?

Thanks a lot!

Felix
</issue_description>

Comments on the Issue (you are @copilot in this section)

@sinedied Sounds like a bug, thanks for the report

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Fixed path.delimiter to path.sep in lib/mock.js for correct folder parsing
- Fixed setRegExp to prevent underscore prefix in set names
- Added tests for folder-based mock sets
- All tests passing

Co-authored-by: sinedied <593151+sinedied@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix mock sets not resolving with folder structure Fix mock set resolution for folder-based organization Feb 2, 2026
Copilot AI requested a review from sinedied February 2, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mock sets don’t resolve when organizing by folder structure

2 participants