File Conventions
Three options:
- End fixture file names with
.fixture.{js,jsx,ts,tsx,md,mdx}. - Put fixture files inside
__fixtures__directories. - Use
fixture.{js,jsx,ts,tsx,md,mdx}as the name.
The file paths of your fixture files (relative to your project root) are used to create a tree view explorer in the React Cosmos UI.
Examples (one fixture file per component)
MyComponent.fixture.jsx__fixtures__/MyComponent.jsxMyComponent/fixture.jsx
- MyComponent
Examples (multiple fixture files per component)
MyComponent/blankState.fixture.jsxMyComponent/__fixtures__/blankState.jsxor__fixtures__/MyComponent/blankState.jsx
- blankState
Configuration
You can customize these file conventions in your Cosmos config:
| Option | Description | Default |
|---|---|---|
fixturesDir | Name for directories that contain fixture files (eg. __fixtures__/example.jsx). | "__fixtures__" |
fixtureFileSuffix | Suffix for fixture files (eg. example.fixture.jsx). | "fixture" |
ignore | Patterns for ignoring fixture and decorator files (eg. ["**/dist/**"]). |