-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix: correctly migrate projects with custom integration folder #19929
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
Conversation
Thanks for taking the time to open a PR!
|
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few question before I feel comfortable approving this one.
// TODO: the current logic is wrong and does not consider | ||
// the case of a custom integration folder! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this test and I see it using a custom integrationFolder
(src
).
I see that files are renamed but left in the same folder.
This feels right.
Can you be more explicit? What logic is wrong? What do we need to consider?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, the comment was from before (when it was wrong). This PR fixes the wrong. I will remove the comment.
afterRegexp: getNewHighlightRegexp('e2e'), | ||
}, | ||
usingCustomIntegrationFolder: { | ||
beforeRegexp: (folder: string) => `${folder}\/.*?(?<ext>[._-]?[s|S]pec.|[.])(?=[j|t]s[x]?)`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can folder contain any special characters? .
or /
could probably make it fail right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea, this regexp has been here for a while. We almost certainly need more unit tests around it. This should be a separate PR, there's likely a ton of complexity to be uncovered when working on this regexp, I will follow it up.
I am thinking the regexp approach may not be ideal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is big, let's do it elsewhere. https://cypress-io.atlassian.net/browse/UNIFY-997
findByTestingType(projectRoot, e2eDirPath, 'e2e'), | ||
]) | ||
): Promise<GetRelativeSpecs> { | ||
const e2e = await findByTestingType(projectRoot, e2eDirPath, 'e2e') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we do not rename component specs anymore?
My understanding was that we wanted the rename to avoid collision with jest when moving component tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We never did auto rename on component specs - only E2E. Component is always manual.
Basically,
- autoRename === e2e
- manualRename === CT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit, apparently this is NOT the case, rename is automated, moving is not. 😮💨
|
||
debug('looked in %s and %s and found %o', compFolder, intFolder, specs) | ||
debug('looked in %s and %s and found %o', intFolder, specs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debug('looked in %s and %s and found %o', intFolder, specs) | |
debug('looked in %s and found %o', intFolder, specs) |
const intFolder = await this.integrationFolder() | ||
|
||
const specs = await getSpecs(this.ctx.currentProject, compFolder || null, intFolder || null) | ||
const specs = await getSpecs(this.ctx.currentProject, intFolder || null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we worry about users who have custom testSpec regex pattern in their <10.0 configuration? Currently the pattern(s) will be used to find the specs, whether or not they are in the integration folder: https://github.com/cypress-io/cypress/blob/develop/packages/server/lib/util/specs.ts#L173
EDIT: Also, why did we remove migrating the tests found in the component folder?
Nevermind. The naming here didn't seem specific to E2e.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, fixing this one up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also re: migrating component tests, you were right, I'd misunderstood a requirement - the first step of the migration will rename them if you are using the defaults, eg cypress/component/foo.spec.js
will become cypress/component/foo.cy.js
. In the next step, we ask you to manually move the component specs to be colocated with their component.
This part of the migration (specifically, for component tests) is really not ideal. Although you can opt to leave them in cypress/component
, most people like to colocate their component tests. Anyway, that's a product/design decision beyond the scope of this PR - the vast majority of users are E2E, and the workflow works really well for those users.
Co-authored-by: Emily Rohrbough <[email protected]>
* 10.0-release: (25 commits) fix(unify): improve dev server config ergonomics (#19957) feat: add spec pattern modal (#19801) fix: Windows e2e project scaffolding issues (#19938) feat: update @cypress/schematic to use proper e2e config for 10.0.0 (#19827) fix: correctly migrate projects with custom integration folder (#19929) fix: component spec creation with spec pattern (#19862) fix: missed committing yarn.lock after merge conflict fix: correct reference branch / commitSha in performance-reporter (#19941) feat: update navbar UI per Figma (#19926) fix: seed examples files when no e2e directory is created (#19768) chore: remove windy lightBlue warning test: component test updates (#19925) feat: Focus browser from select browser screen and on dashboard login (#19842) test: Honeycomb system-test reporter (#19855) fix(deps): update dependency engine.io to v5.2.1 [security] feat: Retain fileName when working with aliased fixtures and files (#19820) Update release-process.md Update release-process.md Update release-process.md Update release-process.md ...
resolves: https://cypress-io.atlassian.net/browse/UNIFY-989
One of the migration use cases was not handled correctly. We had an example project but didn't have the right assertions to verify it. Now we do.
The correct UI looks like this (screenshot from the test I added). Note it shows
src/basic.spec.js
correctly (src
is the custom integration folder for this project).We were not handling the case where the config is:
We had a regexp hard-coded to use
cypress/...
, we should use their custom integration folder.Also, we were including component specs in the E2E auto migration step - that's incorrect, so I fixed it. All of the fixes have tests - finally, the migration UI is getting in shape.