question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`nrwl/react` not generating storybook and cypress test

See original GitHub issue

Current Behavior

Using CLI I am trying to generate storybook and cypress test components but it’s giving us an error

Cannot file react component in file

Using these set of commands to generate

nx g @nrwl/react:component-story --project=dsm-atoms --componentPath=/lib/st-tag/st-tag.tsx
nx g @nrwl/react:component-cypress-spec --project=dsm-atoms --componentPath=/lib/st-tag/st-tag.tsx

The component exists and was generated by using nx cli at the specified path

nx g @nrwl/react:component st-tag --project=dsm-atoms --dry-run

Expected Behavior

Generate storybook and cypress test using CLI

Steps to Reproduce

Mentioned above

Failure Logs

Screenshot 2021-10-03 at 10 28 59 PM

Environment

Report Generated using nx report

Node : 14.17.6 OS : darwin x64 npm : 7.24.1

nx : Not Found @nrwl/angular : Not Found @nrwl/cli : 12.9.0 @nrwl/cypress : 12.9.0 @nrwl/devkit : 12.9.0 @nrwl/eslint-plugin-nx : 12.9.0 @nrwl/express : Not Found @nrwl/jest : 12.9.0 @nrwl/linter : 12.9.0 @nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : Not Found @nrwl/nx-cloud : Not Found @nrwl/react : 12.9.0 @nrwl/schematics : Not Found @nrwl/tao : 12.9.0 @nrwl/web : 12.9.0 @nrwl/workspace : 12.9.0 @nrwl/storybook : 12.9.0 @nrwl/gatsby : Not Found typescript : 4.3.5

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
MuhammadAnas190commented, Oct 7, 2021

@puku0x alright but it’s giving me the same error on generating story as well and even after adding a default. Yet still not able to generate the story and e2e test.

Screenshot 2021-10-07 at 10 06 10 PM
1reaction
juristrcommented, Oct 19, 2021

It works for me if I generate a React component with Nx and then use the component-story generator like

nx generate @nrwl/react:component-story --componentPath=lib/greeter/greeter.tsx --project=reactui

@MuhammadAnas190 can you paste here how the component looks like? Doesn’t need to have the implementation itself, but the main component function and exports etc would be helpful. Thanks 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

nrwl/react:stories does not generate Storybook stories
Rename the components folder to lib. From src/components/ to src/lib/. This is because the default value in .storybook/main.js resolves to ...
Read more >
@nrwl/react:cypress-component-configuration | Nx
This generator is for Cypress based component testing. If you want to test components via Storybook with Cypress, then check out the storybook-configuration ......
Read more >
@nrwl/storybook - npm
The Nx Plugin for Storybook contains executors and generators for allowing your workspace to use the powerful Storybook integration testing ...
Read more >
Nx 8.8: Now You Can Write UI Tests with Storybook and Cypress
No matter what you do to a unit test, it will always have low fidelity. ... Configure Storybook for the library; Optionally create...
Read more >
Using Nx for React and Typescript Monorepos - Ryosuke
nx g @nrwl/react:component button --project=ui --export ... This will also generate a Storybook .story test for any ... Why not Nx.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found