-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Extend docs on how to write a custom devServer #5211
Conversation
fochlac
commented
Apr 24, 2023
- switch section on custom index html file and dev server, so it's already explained when mentioning it in the dev-server-section
- add a minimal example for the test-kickstart-script
- update documentation of the parameters
- add some explanation on the role of the dev-server
👷 Deploy request for cypress-docs pending review.Visit the deploys page to approve it
|
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.
Nice job reverse engineering this!
server. | ||
|
||
```ts | ||
interface DevServerOptions { |
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.
Nice - we should probably expose this via Cypress.DevServerOptions
in the future to help guide third parties.
docs/guides/component-testing/component-framework-configuration.mdx
Outdated
Show resolved
Hide resolved
docs/guides/component-testing/component-framework-configuration.mdx
Outdated
Show resolved
Hide resolved
docs/guides/component-testing/component-framework-configuration.mdx
Outdated
Show resolved
Hide resolved
docs/guides/component-testing/component-framework-configuration.mdx
Outdated
Show resolved
Hide resolved
const absolute = CypressInstance.config('supportFile') | ||
const relative = absolute.replace(CypressInstance.config('projectRoot'), '') | ||
const relativeUrl = `${devServerPublicPathRoute}${relative}` | ||
imports.push({ |
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 had a closer look into the load mechanism, and this format causes the script to be loaded twice:
https://github.com/cypress-io/cypress/blob/7a33f5c1a87f5a3aa3b8da575b39e42f93bfd5db/packages/driver/src/cypress/script_utils.ts#L6
First it will be fetched in the fetchScript
function, and later in evalScripts
the load-function is triggered, wich causes the import to fetch the contents again.
It's propably better to just pass the importFunctions and use the alternative path here: https://github.com/cypress-io/cypress/blob/7a33f5c1a87f5a3aa3b8da575b39e42f93bfd5db/packages/driver/src/cypress/script_utils.ts#L49
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 propably should be fixed for the vite-dev-server as well
* switch section on custom index html file and dev server, so it's already explained when mentioning it in the dev-server-section * add a minimal example for the test-kickstart-script * update documentation of the parameters * add some explanation on the role of the dev-server
* add links to code-examples
* add sample file server * extend client script to also show import of support file
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.
Hi! Quick few nits and we are good to go. Thanks, this looks great!
docs/guides/component-testing/component-framework-configuration.mdx
Outdated
Show resolved
Hide resolved
docs/guides/component-testing/component-framework-configuration.mdx
Outdated
Show resolved
Hide resolved
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
docs/guides/component-testing/component-framework-configuration.mdx
Outdated
Show resolved
Hide resolved
Thanks 🎉 |