Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a Cypress App for a React Storybook Library Fails #21770

Closed
1 of 4 tasks
smasala opened this issue Feb 10, 2024 · 1 comment · Fixed by #23327
Closed
1 of 4 tasks

Creating a Cypress App for a React Storybook Library Fails #21770

smasala opened this issue Feb 10, 2024 · 1 comment · Fixed by #23327
Assignees
Labels
scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug

Comments

@smasala
Copy link
Contributor

smasala commented Feb 10, 2024

Current Behavior

npx nx g @nx/storybook:cypress-project myReactLibWithStorybook fails

>  NX   Cannot read properties of undefined (reading 'options')


TypeError: Cannot read properties of undefined (reading 'options')
    at updateAngularJsonBuilder (/node_modules/@nx/storybook/src/generators/cypress-project/cypress-project.js:96:26)

Expected Behavior

A Cypress App for the UI library is generated

GitHub Repo

No response

Steps to Reproduce

  1. generate React UI library
  2. add storybook configuration to the react library
  3. run npx nx g @nx/storybook:cypress-project myReactLibWithStorybook

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 21.6.1
   OS     : linux-x64
   npm    : 10.2.4
   
   nx                 : 18.0.4
   @nx/js             : 18.0.4
   @nx/jest           : 18.0.4
   @nx/linter         : 18.0.4
   @nx/eslint         : 18.0.4
   @nx/workspace      : 18.0.4
   @nx/cypress        : 18.0.4
   @nx/devkit         : 18.0.4
   @nx/eslint-plugin  : 18.0.4
   @nx/react          : 18.0.4
   @nx/rollup         : 18.0.4
   @nx/storybook      : 18.0.4
   @nrwl/tao          : 18.0.4
   @nx/web            : 18.0.4
   @nx/webpack        : 18.0.4
   typescript         : 5.3.3

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

should read:

The line should read ...e2eTarget?.options - there is no app, since we are generating it at this point, so e2eTarget is of course undefined. If you manually add ? then the generator run successfully.

@AgentEnder AgentEnder added the scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx label Feb 16, 2024
@Coly010
Copy link
Contributor

Coly010 commented May 13, 2024

Thank you for bringing this issue to our attention! I want to assure you that I will take a look as soon as I can.

Coly010 added a commit that referenced this issue May 13, 2024
…s project #21770 (#23327)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->
The `@nx/storybook:cypress-project` generator expects there to be a
defined target for e2e target.
However, since the introduction of inference, this may not be the case.
This results in the generator erroring


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
The `@nx/storybook:cypress-project` generator should handle inference
and generate an appropriate cypress.config.ts file


## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #21770
FrozenPandaz pushed a commit that referenced this issue May 13, 2024
…s project #21770 (#23327)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->
The `@nx/storybook:cypress-project` generator expects there to be a
defined target for e2e target.
However, since the introduction of inference, this may not be the case.
This results in the generator erroring

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
The `@nx/storybook:cypress-project` generator should handle inference
and generate an appropriate cypress.config.ts file

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #21770

(cherry picked from commit 61129f4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants