cypress: Defining supportFile outside the root in Windows throws error: invalid WIN32 path characters

I’m working on a monorepo project and as many monorepo projects do they tend to have their own CLI on top of to do common things across packages. One of these things is to run test.

The problem that I’m having is that when I place the plugins/index file outside the project root I get the following error message:

......\mono-cli\src\cypress\plugins contains invalid WIN32 path characters.

but as soon as I place the plugins/index file inside the project root and require the plugins/index file from outside the root of the project it works. This also happens for the support/index file.

Current behavior:

When I place the plugins/index or support/index file outside the root folder I get the following error: Error: C:\Users\baldurarna\AppData\Roaming\Cypress\cy\production\projects\MMS-3bc48668dc408d2c7575d3d91289f8f1\bundles\C:\Code\Frontend\Cosmic\tools\mono-cli\src\cypress\support contains invalid WIN32 path characters.

Desired behavior:

Having these files outside the root of the project should work the same as having them inside the root of the project.

Versions

Cypress: 3.1 Chrome: 69

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 8
  • Comments: 15 (2 by maintainers)

Most upvoted comments

Is there any progress on this? It is still a Blocker for all nx-workspace users on Windows.

Version Cypress: 3.3.1 Nx: 8.1.0

This is still happening on Windows within an Nx environment with cypress e2e setup as well.

"supportFile": "../../dist/out-tsc/apps/web-example-e2e/src/support", will work on Mac, but not windows.

Same Nx/Cypress issue as @MarkPieszak & @EirikBirkeland are having… as soon as you provide a value for supportFile i.e."supportFile": "../../dist/out-tsc/apps/app1-e2e/src/support/index.js" it breaks.

Interesting - probably paths handling on Windows is incorrect, we will look into it. For now here is a workaround:

  • in each subproject have its cypress/plugins/index.js export required root plugins file like
module.exports = require('../../../plugins')
  • same for support file - just import shared support file
import '../../../support'

See example of this in https://github.com/bahmutov/multiple-cy-example - there are two subfolders one and two but they reuse common support.js and plugins.js files

Same issue here… My Windows users cannot get this to work at all.

image

@spoldman did the issue #853 solved your problem ? It looks like I have the same problem, having created an Angular mono-repo project with Nx ; I get

Oops...we found an error preparing this test file:
  ..\..\dist\out-tsc\apps\frontend-e2e\src\support\index.js
The error was:
Error: C:\Users\Me\AppData\Roaming\Cypress\cy\production\projects\frontend-e2e-8ce4430423f282711e3fec07c048a172\bundles\C:\dev\myApp\dist\out-tsc\apps\frontend-e2e\src\support contains invalid WIN32 path characters.

Version

Cypress: 3.1.5