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

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

Closed
spoldman opened this issue Oct 11, 2018 · 15 comments
Labels
OS: windows stage: ready for work The issue is reproducible and in scope stale no activity on this issue for a long period topic: plugins ⚙️ type: bug

Comments

@spoldman
Copy link

spoldman commented Oct 11, 2018

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

@chrisbreiding chrisbreiding added the stage: needs investigating Someone from Cypress needs to look at this label Oct 16, 2018
@euZebe
Copy link

euZebe commented Mar 12, 2019

@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

@MarkPieszak
Copy link

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.

@danielquintero
Copy link

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.

@okirmis
Copy link

okirmis commented Mar 22, 2019

We have the same problem at the moment on Windows. I can confirm that exactly the same project runs fine on Linux and OSX.

> cypress --version
Cypress package version: 3.2.0
Cypress binary version: 3.2.0

After looking through the code a bit I suspect that the bug is somewhere in the https://github.com/cypress-io/cypress/blob/develop/packages/server/lib/plugins/preprocessor.coffee#L38 (in the appData.projectsPath call)

@cypress-bot cypress-bot bot added stage: ready for work The issue is reproducible and in scope and removed stage: needs investigating Someone from Cypress needs to look at this labels Apr 18, 2019
@jennifer-shehane jennifer-shehane changed the title Having support or plugin files outside the root causes errors. Defining supportFile outside the root in Windows throws error: invalid WIN32 path characters Apr 18, 2019
@motabass
Copy link

motabass commented Jun 5, 2019

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

@ysdidenko
Copy link

ysdidenko commented Jun 6, 2019

We are experiencing the same issue.
The only ugly way to proceed with this somehow was to remove the reference to custom support file
"supportFile": "../../dist/out-tsc/your_path/support/index.js", then duplicate the folder with support (both index.js adc commands.js) in cypress folder. Leaving the same support folder in our /src, with the .ts files instead...

@okirmis
Copy link

okirmis commented Jun 6, 2019

This forces us to work with WSL and XMing. That's a pretty buggy and unstable setup.

@csutorasr
Copy link

A workaround can be to import the file in each spec.

import '../support/index.ts';

This can replace the /// <references> if you put that into the support/index.ts. This can be done with find and replace this way.

@EigenTheory
Copy link

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

image

@bahmutov
Copy link
Contributor

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

@euZebe
Copy link

euZebe commented Jun 24, 2019

Thanks @bahmutov !
Not sure this is an easy way to start contributing to Cypress, but I would be glad to help if I can have a hint.

@bahmutov
Copy link
Contributor

bahmutov commented Jun 24, 2019 via email

@cport93
Copy link

cport93 commented Aug 10, 2020

I'm getting the same issue, im trying to use the directory "/support" in other repo but i got the same error.
this is mi path for integration tests:
C:\Git\test-view-ts\cypress\integration\test1.js

Inside the code trying to import the support files:

import {
    some_already_exported_function
}
from '../../../../../cy-config-ts/cypress/support/index.js'

Path of support file:
C:\Git\cy-config-ts\cypress\support\index.js

this is my cypress.json:

{
   "supportFile" : "/Git/cy-config-ts/cypress/support/index.js",
}

and i got this message:
Error: C:\Users\caportillo\AppData\Roaming\Cypress\cy\production\projects\test-view-ts-26918ea0ae940a886090e981042d163e\bundles\C:\Git\cy-config-ts\cypress\support contains invalid WIN32 path characters.

@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label May 18, 2023
@cypress-app-bot
Copy link
Collaborator

This issue has been closed due to inactivity.

@cypress-app-bot cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS: windows stage: ready for work The issue is reproducible and in scope stale no activity on this issue for a long period topic: plugins ⚙️ type: bug
Projects
None yet
Development

No branches or pull requests