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

Cypress Code Coverage and nextjs #19131

Closed
1 task done
erenken opened this issue Sep 12, 2023 · 3 comments · Fixed by #19171
Closed
1 task done

Cypress Code Coverage and nextjs #19131

erenken opened this issue Sep 12, 2023 · 3 comments · Fixed by #19171
Labels
outdated scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: feature

Comments

@erenken
Copy link
Contributor

erenken commented Sep 12, 2023

Description

I would like Cypress Code Coverage to work in a next project when using nxComponentTestingPreset. Currently it works if you are using a react project and importing nxComponentTestingPreset from @nx/react/plugins/component-testing, but tests using NavLink fail because they are missing process.

There is a slight difference in nxComponentTestingPreset between next and react. They use a different compiler. next uses swc and react uses babel. If I change my local code in next/plugins/compoent-testing.js to use babel instead of swc I get proper code coverage results in next.

Motivation

Having Cypress Code Coverage working in a next project would be nice, and something the company I work for is striving to implement coverage requirements.

Suggested Implementation

I imagine adding a compiler property to NxComponentTestingOptions and if it is set use that property here compiler: 'swc'

I would change

compiler: 'swc',

to

compiler: options?.compiler || 'swc',

And add compiler as an optional property on NxComponentTestingOptions.

Alternate Implementations

Just change it to be compiler: 'babel' so it matches the react configuration.

@AgentEnder AgentEnder added the scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx label Sep 13, 2023
erenken added a commit to erenken/nx that referenced this issue Sep 14, 2023
…set`

Currently nextjs only uses the *swa* compiler

To use @cypress/code-coverage you need to use *babel*, you can now select which compiler to use.

closed nrwl#19131
@erenken
Copy link
Contributor Author

erenken commented Sep 26, 2023

Anyone have any ideas why the check, main-linux is failing on my PR. There seems to be a problem in storybook creation. It looks like a lot of people are having the same problem as me. Is this getting resolved somewhere? I'm updating my PR with the latest main, hopefully someone has fixed this.

@erenken
Copy link
Contributor Author

erenken commented Sep 26, 2023

Never mind, something must have gotten fixed, I just updated from main and all the checks passed, now it just needs to get merged in.

erenken added a commit to erenken/nx that referenced this issue Oct 10, 2023
…set`

Currently nextjs only uses the *swa* compiler

To use @cypress/code-coverage you need to use *babel*, you can now select which compiler to use.

closed nrwl#19131
erenken added a commit to erenken/nx that referenced this issue Oct 29, 2023
…set`

Currently nextjs only uses the *swa* compiler

To use @cypress/code-coverage you need to use *babel*, you can now select which compiler to use.

closed nrwl#19131
erenken added a commit to erenken/nx that referenced this issue Oct 29, 2023
…set`

Currently nextjs only uses the *swa* compiler

To use @cypress/code-coverage you need to use *babel*, you can now select which compiler to use.

closed nrwl#19131
erenken added a commit to erenken/nx that referenced this issue Oct 29, 2023
…set`

Currently nextjs only uses the *swa* compiler

To use @cypress/code-coverage you need to use *babel*, you can now select which compiler to use.

closed nrwl#19131
erenken added a commit to erenken/nx that referenced this issue Nov 2, 2023
…set`

Currently nextjs only uses the *swa* compiler

To use @cypress/code-coverage you need to use *babel*, you can now select which compiler to use.

closed nrwl#19131
erenken added a commit to erenken/nx that referenced this issue Nov 2, 2023
…set`

Currently nextjs only uses the *swa* compiler

To use @cypress/code-coverage you need to use *babel*, you can now select which compiler to use.

closed nrwl#19131
erenken added a commit to erenken/nx that referenced this issue Nov 2, 2023
…set`

Currently nextjs only uses the *swa* compiler

To use @cypress/code-coverage you need to use *babel*, you can now select which compiler to use.

closed nrwl#19131
erenken added a commit to erenken/nx that referenced this issue Nov 2, 2023
…set`

Currently nextjs only uses the *swa* compiler

To use @cypress/code-coverage you need to use *babel*, you can now select which compiler to use.

closed nrwl#19131
erenken added a commit to erenken/nx that referenced this issue Nov 2, 2023
…set`

Currently nextjs only uses the *swa* compiler

To use @cypress/code-coverage you need to use *babel*, you can now select which compiler to use.

closed nrwl#19131
Copy link

github-actions bot commented Dec 4, 2023

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants