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.

Deprecate @nrwl/cypress/plugins/preprocessor

See original GitHub issue

In the generated index.js pluginFile of cypress the nx helper is there to preprocess TS Files.

  // Preprocess Typescript file using Nx helper
  on('file:preprocessor', preprocessTypescript(config));

Since Cypress 4.4.0 (4/13/2020), it supports typescript out of the box

Added support for TypeScript without needing your own transpilation through preprocessors.

https://docs.cypress.io/guides/tooling/typescript-support.html#History

If the nx preprocessor is more than that, then please clarify in the comment why it’s needed.

In a fresh project I tried to run e2e with the plugin removed and it ran fine. But then again, that was an empty workspace with a blank angular app.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:6

github_iconTop GitHub Comments

3reactions
george43gcommented, May 26, 2020

The latest Cypress has TS support built-in. I’m not sure what this means about the preprocessor hook personally - check out this thread for more info: https://github.com/cypress-io/cypress/pull/5906

But I wanted to point out a couple of important points: In the default schematic, the generated cypress.json file should have a few changes made: the pluginsFile needs to point directly to plugins/index.ts with the file extension. The default from when I set it up earlier in the year was plugins/index. This caused a crash.

This means that the default pluginsFile also needs to be updated to TS. I actually suspect that their preprocessor does a little more than transpile - it also had some tsconfig paths module in its source code and I suspect this is set up this way in order to be able to resolve the library paths as configured in the paths property in tsconfig. This is generally a pain point with tsc and is why they use webpack to bundle apps in NX. In order to be able to resolve these library paths while running ts-node, I think you might need extra functionality in the preprocessor, hence why they built their own rather than using the one that was available previously to the Cypress community.

It would be really helpful to be able to not only write plugins in TS, but also be able to require TS libraries from within the plugins file!

I also think that typescript: 'project' is a setting that should be set as well (please double-check this as I only had a cursory glance) but I’m not sure where from. I just know it’s checked in the Cypress source code.

3reactions
FrozenPandazcommented, May 21, 2020

I agree, let’s start investigating by opening a PR against https://github.com/nrwl/nx-examples with the preprocessor removed to see if everything works as expected there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - Deprecate @nrwl/cypress/plugins/preprocessor -
Coming soon: A brand new website interface for an even better experience!
Read more >
@nrwl/cypress | Nx
Cypress is a test runner built for the modern web. It has a lot of great features: Time travel; Real-time reloads; Automatic waiting;...
Read more >
Use .feature files in cypress with nrwl nx - Stack Overflow
At the root of the nx project, add a file named cypress-cucumber-preprocessor.config.js The cypress-cucumber-preprocessor property in package.
Read more >
Plugins - Cypress Documentation
Plugins provide a way to support and extend the behavior of Cypress. ... community. Cypress preprocessor for extracting tests from Markdown files. #markdown ......
Read more >
cypress-io/cypress - Gitter
Error: Cannot find module '@nrwl/cypress/plugins/preprocessor' Require stack: ... If I remove Import line - then there is no crash. Sandra Ouadghiri.
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