You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With such a structure, React Cosmos loads and displays for me the fixtures Feature/InternalComponent1 and Feature/InternalComponent2, but it doesn't display the fixture Feature. I assume that's because the other fixtures are picked up first and "block" the name Feature, preventing another fixture from being called like that.
If I rename the file from src/Feature.fixture.tsx to something else, like src/Feature_.fixture.tsx, then the fixture loads.
I can use that fact as a workaround but I would match rather have all filenames match.
User info
React Cosmos version 5.6.3, Webpack version 5.38.1.
The text was updated successfully, but these errors were encountered:
ovidiuch
changed the title
Fixture not loaded if other fixtures exist in a directory with the same name
Allow fixture files and directories with the same name
Sep 6, 2021
Thanks for pointing this out. I can't be 100% sure without checking, but I believe this is by design. Another pattern that Cosmos supports is index files – src/Feature/index.tsx, which shows up as src/Feature in Cosmos. This is possibly the reason why Cosmos doesn't work as you'd want to in your case, but it doesn't necessarily mean it can't accommodate both cases with some refactor.
I've moved your issue in the RFCs repo because this sounds more like a feature request. If anyone is interested in looking into this I'm happy to help with finding the relevant code and test files.
What's wrong?
This is how I structure my projects:
With fixtures, it looks like this:
With such a structure, React Cosmos loads and displays for me the fixtures
Feature/InternalComponent1
andFeature/InternalComponent2
, but it doesn't display the fixtureFeature
. I assume that's because the other fixtures are picked up first and "block" the nameFeature
, preventing another fixture from being called like that.If I rename the file from
src/Feature.fixture.tsx
to something else, likesrc/Feature_.fixture.tsx
, then the fixture loads.I can use that fact as a workaround but I would match rather have all filenames match.
User info
React Cosmos version 5.6.3, Webpack version 5.38.1.
The text was updated successfully, but these errors were encountered: