Closed denis-domanskii closed 9 months ago
Ok, I just found the issue. I have the following project structure:
my-app/
├── frontend
├── tests/
│ └── cypress/
│ ├── integration/
│ │ └── super.spec.ts
│ ├── cypress.config.js
│ └── package.json
└── package.json
My root package.json
contains script
"cy:test": start-server-and-test 'yarn start-test-server' http-get://localhost:7072 'SPLIT=1 SPLIT_INDEX=0 cypress run --e2e --config-file tests/cypress/cypress.config.ts --browser chrome --reporter teamcity'",
And cypress.config.ts
have the following specPattern
:
specPattern: 'tests/cypress/integration/**/*.spec.ts*',
With such setup cypress-split doesn't work, showing 0 specs, when running it from the project root dir using the npm script above. And find-cypress-specs
works perfect.
But when I change specPattern
to
specPattern: 'integration/**/*.spec.ts*',
'cypress-split' found all the specs and run it. So, for some reason, it's not dir-agnostic and I'd say it's an issue.
The problem is when cypress-split
executes, it runs inside Cypress. Cypress changes the working directory to the same folder as the config file. So from tests/cypress
the path 'tests/cypress/integration/*/.spec.ts*' makes no sense, right? I think Cypress itself has a fallback in this case, but regular globby
inside find-cypress-specs
does not. When you run find-cypress-specs
by itself, you are running from the root folder, so it makes sense to find the specs. I need to think how to better solve this
Let me see if I can fix this, I added something in https://github.com/bahmutov/find-cypress-specs/issues/188 for this
:tada: This issue has been resolved in version 1.5.4 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version 1.5.5 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Hi! I faced the issue with finding the specs. cypress-split found 0 of them.
I read that cypress-split is based on find-cypress-specs, so I ran it separately from the same dir and it found all the specs:
In both scenarios it definitely reads the custom config file, because specPattern is correct. But something is wrong in cypress-split <-> find-cypress-specs interaction. I tried cypress-on-fix, but nothing changed. Also I tried to explicitly pass CYPRESS_CONFIG_FILE env variable to cypress, but nothing change too.