-
Notifications
You must be signed in to change notification settings - Fork 3.4k
refactor: lift indexHtmlFile up to component, add validation #20870
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 ➡️ Flakiness
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 |
||||||||||||||||||||||||||
| * @default {} | ||
| */ | ||
| e2e: CoreConfigOptions | ||
| e2e: Omit<CoreConfigOptions, 'indexHtmlFile'> |
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.
Is there a reason we want this on CoreConfigOptions rather than ComponentConfigOptions?
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.
My understanding is that, once the config is resolved, you should access the properties as root level properties since testingType specific options are merged to be top-level. So inside of startServer.ts for webpack, you should be able to do config.indexHtmlFile rather than config.component.indexHtmlFile (the config passed into the devServer doesn't even have a component object so you can't do config.component.indexHtmlFile).
The options in ComponentConfigOptions aren't typed at the root level, so if I wanted to define them there we would have to refactor those types.
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 think for the devServer we're generally going to be accessing the properties off of the un-merged config anyway, because the merging happens in the parent process and we can't serialize/unserialize a user's webpackConfig over the wire (ran into that when refactoring the object API)
The options in ComponentConfigOptions aren't typed at the root level,
Might not be sure what you're referring to - I was just saying to add the type to this interface:
interface ComponentConfigOptions<ComponentDevServerOpts = any> extends Omit<CoreConfigOptions, 'baseUrl'> {
devServer: DevServerFn<ComponentDevServerOpts>
devServerConfig?: ComponentDevServerOpts
}
And then use it from that to pass into startServer directly
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.
@ZachJW34 nice - this all seems pretty straight forward, since getTemplateHtml isn't implemented, and we are just lifting the indexHtmlFile up
If we are going to do the getTemplateHtml changes separately, I think we should:
- Update the Jira ticket to reflect the actual work done here (right now based on Jira, it looks like everything should be here, which it's not)
- Create a new ticket with the remaining work to be done
What do you think?
Not sure what's going on with Percy, 💀
|
@lmiller1990 I'll update the issue now, was just going to wait a bit to see how the PR shakes out. Updated and created a new issue. Merged latest master and the crazy Percy diffs went away. |
* 10.0-release: fix: add index.mjs to the published files of cli (#20884) refactor: lift indexHtmlFile up to component, add validation (#20870) fix: allow migration of pluginsFile using `env` properties (#20770) fix: viewport from CLI on CT (#20849) fix: git data source unit test failure (#20875) fix: Ensuring current browser is synchronized between app and launchpad (#20830) Fix missed await on merge conflict resolution test(unification): move record keys to contexts (#20860) test: move record keys to contexts (#20859) make alerts more responsive chore: Update Chrome (stable) to 100.0.4896.60 (#20841) Revise test. fix: cy.root respect timeout option. fix(deps): update dependency ansi-regex to v4.1.1 [security] (#20836) chore(deps): update dependency ansi-regex to 4.1.1 [security] (#20807) chore: Refactor cri-client to use async/await (#20825) remove automationId from runnerStore fix firefox automation and adress feedback feat: add automation warning/disconnected states in app
…ess into tgriesser/fix/UNIFY-1389 * 'tgriesser/fix/UNIFY-1389' of github.com:cypress-io/cypress: (56 commits) fix: add index.mjs to the published files of cli (#20884) refactor: lift indexHtmlFile up to component, add validation (#20870) fix: allow migration of pluginsFile using `env` properties (#20770) fix: viewport from CLI on CT (#20849) Don't communicate if process isn't connected Remove config.get Update packages/data-context/src/data/ProjectLifecycleManager.ts fix: git data source unit test failure (#20875) add comment for autoBindDebug PR comments Fix tests that visit app without a configured testing type Fix type script Fix issue with refreshing on the welcome screen Add test for migration scenario Fix types Move IPC logic to all be in ProjectConfigIPC Other minor cleanup Additional code cleanup Fix more tests Fix typo ...
* 10.0-release: (92 commits) chore: remove dependency-tree dep (#20905) chore(launchpad): work on infra for scaffold tests (#20818) fix: build mjs in the cli (#20889) fix(unify): Cypress version link should point to Cypress doc's changelog (#20869) fix: windows build (#20854) fix: add index.mjs to the published files of cli (#20884) refactor: lift indexHtmlFile up to component, add validation (#20870) fix: allow migration of pluginsFile using `env` properties (#20770) fix: viewport from CLI on CT (#20849) Don't communicate if process isn't connected Remove config.get Update packages/data-context/src/data/ProjectLifecycleManager.ts fix: git data source unit test failure (#20875) add comment for autoBindDebug fix: Ensuring current browser is synchronized between app and launchpad (#20830) Fix missed await on merge conflict resolution test(unification): move record keys to contexts (#20860) test: move record keys to contexts (#20859) PR comments Fix tests that visit app without a configured testing type ...
User facing changelog
Lift
indexHtmlFileup tocomponentconfig and validate the property is only valid on the component config.Additional details
The PR is broken up into two commits, the first contains the logic for lifting the property and adding validation and the second adds the missing
component-index.htmlfile to projects that were relying on the default (hopefully makes it easier to review). There is no longer a fallback template for@cypress/webpack-dev-serverand@cypress/vite-dev-serversince we are scaffolding this file to the users project atcypress/support/component-index.htmlwhich will be the default value ofcomponent.indexHtmlFile.There is validation of the
indexHtmlFileproperty to ensure that it is not added at the root level of the config or in the e2e config. All devServers have been updated to pull this value from the cypress config rather than passing the option explicitly.I did not implement the
getTemplateAPI outlined in the issue as that is an implementation detail that should be implemented after the Object API is merged, I will update the ticket and create another one to implement it. We already have this logic inside of WizardActions, it's just not ideal but we can move forward without it.The removal of the
templateproperty from@cypress/webpack-dev-serveris a breaking change but we already plan on making breaking changes to the dev-servers. These changes won't be released until 10.0 and there is an issue for ensuring 9.x users don't use the 10.0 supported version. This property was mostly an internal property and not documented.How has the user experience changed?
User no longer needs to specify
indexHtmlFilein their config asconfig.component.indexHtmlFilewill have a default value ofcypress/support/component-index.htmlwhich is scaffolded for them during project setup.Before:
After:
PR Tasks
cypress-documentation? Notion is up to datetype definitions?cypress.schema.json?