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.

Cannot run cypress e2e tests for a node app

See original GitHub issue

Current Behavior

The @nrwl/cypress:cypress builder doesn’t seem to work when I pass a node app (which is using the @nrwl/node:node builder) as the devServerTarget. The node app gets compiled and served correctly, but cypress just never starts.

Expected Behavior

After compiling and serving the app, cypress should start testing.

Steps to Reproduce

Create a new node app, create a new e2e app targeting it, and try running it.

Environment

nx report

 >  NX   Report complete - copy this into the issue template

   Node : 14.18.1
   OS   : darwin arm64
   npm  : 6.14.16
   
   nx : 14.2.4
   @nrwl/angular : 14.2.4
   @nrwl/cypress : 14.2.4
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.2.4
   @nrwl/eslint-plugin-nx : 14.2.4
   @nrwl/express : 14.2.4
   @nrwl/jest : 14.2.4
   @nrwl/js : 14.2.4
   @nrwl/linter : 14.2.4
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : 14.2.4
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.2.4
   @nrwl/web : Not Found
   @nrwl/workspace : 14.2.4
   typescript : 4.5.5
   ---------------------------------------
   Community plugins:
   	 @ng-bootstrap/ng-bootstrap: 12.1.2
   	 @ngrx/component-store: 13.2.0
   	 @ngrx/effects: 13.2.0
   	 @ngrx/router-store: 13.2.0
   	 @ngrx/store: 13.2.0
   	 @ngrx/store-devtools: 13.2.0
   	 @nguniversal/common: 13.1.1
   	 @nguniversal/express-engine: 13.1.1
   	 @nguniversal/builders: 13.1.1

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:26 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
nartccommented, Sep 23, 2022

Not stale. @ple16 thank you for the example.

We’re still looking for an optimal way to do this.

1reaction
ple16commented, Aug 4, 2022

Hi @nartc,

Yes it does work that way.

I’ve also just seen this pr https://github.com/nrwl/nx/pull/11325 and given that’s it’s switched to using the node executor for a custom server I think that’s possibly going to introduce the issue with cypress being able to serve.

I think I’m going to have a crack at writing a little executor as per https://nx.dev/executors/creating-custom-builders that just calls the node executor but takes an additional prop when I can set the baseUrl and return just see if I can’t trick cypress into running

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to write end-to-end tests with Cypress and Node.js
If you're writing production-grade web apps, writing E2E tests is a no-brainer. In this article, we'll take a look at how to write...
Read more >
Troubleshooting | Cypress Documentation
Open Cypress via cypress open · Go to Developer Tools -> View App Data · This will take you to the directory in...
Read more >
Testing Your App | Cypress Documentation
Step 1: Start your server. Assuming you've successfully installed Cypress and opened Cypress in your project, the first thing you'll want to do...
Read more >
Command Line - Cypress Documentation
Run tests specifying a single test file to run instead of all tests. The spec path should be an absolute path or can...
Read more >
Module API - Cypress Documentation
You can require Cypress as a node module from your application under test and run Cypress via Node.js. This can be useful when...
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