90poe / vscode-cy-helper

VS Code IDE Extension for Cypress.io

Home Page:https://marketplace.visualstudio.com/items?itemName=Shelex.vscode-cy-helper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Run Cypress uses 'to much' path in a vscode workspace sub project

ZeroKiwi opened this issue · comments

Describe the bug
On "Run Cypress" the specified spec path overlaps with the project root folder path.

Output from my console:

User@Pc MINGW64 /d/dev/root-project/sub-project (master)
$ npx cypress run --spec "sub-project\spec\some-test.spec.ts"
Can't run because no spec files were found.
We searched for any files matching this glob pattern:
sub-project\spec\some-test.spec.ts
Relative to the project root folder:
D:\dev\root-project\sub-project

To Reproduce
Steps to reproduce the behavior:
Probably setting up a vs-code workspace project with a sub project where cypress is installed causes this problem.
The defined spec starts from workspace root, but the console is set to the project or something like that.

Expected behavior
The defined spec should not include "sub-project". Maybe it shouldn't include the path to the file?
Maybe a config option to switch this behavior?

Environment (please complete the following information):

  • Extension version: 1.2.0
  • VS Code version: 1.54.3
  • OS: Windows 10

Hello @ZeroKiwi
Thank you for opening an issue.

Yes, you are right, nested projects structure my be not supported in this extension (actually I don't event tested such approach).
In v.1.2.1 terminals will be spawned with specified current working directory.
In case you are running spec "d\dev\root-project\sub-project\spec\some-test.spec.ts" now it will check if there is file package.json in one of folders before spec file. In this case it is "sub-project".
Same also would work with Cypress Open code lense - it will spawn terminal running cypress instance for specific sub-project.

Hope it solves your case.

@Shelex Thanks a lot! That did it.