Skip to content
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

feat: adding vite-dev-server plugin #14839

Merged
merged 5 commits into from
Feb 10, 2021
Merged

feat: adding vite-dev-server plugin #14839

merged 5 commits into from
Feb 10, 2021

Conversation

JessicaSachs
Copy link
Contributor

@JessicaSachs JessicaSachs commented Feb 1, 2021

Terminal Screenshot

Screen Shot 2021-01-31 at 9 39 41 PM

Userspace Usage

Identical to @cypress/webpack-dev-server

// plugins.js file
import { startDevServer } from '@cypress/vite-dev-server'

module.exports = (on, config) => {
  on('dev-server:start', async (options) => {
    // viteConfig is optional -- we need tests for this in a playground
    return startDevServer({ options }) 
  })

  return config
}

How to test (isolated -- no components)

  1. yarn install
  2. cd npm/vite-dev-server
  3. yarn cy:open # or yarn cy:run

TODO

Re-running specs when the dependency graph changes
Updating the watched specs or their dependencies does not restart the Cypress runner. Manually restarting the test does trigger a re-run with the updated source in the dep graph. Need to figure out the right hooks inside of Vite to do manually do this.

Compilation error handling
We do not proxy up compile errors via the devServerEvents EE

Playground Tests
The Vite tests test loading specs via the dev-server:start plugin hook. We still need to go through the playground examples (Vite has their own playground we can use!)

Performance
Compared to Vite, Cypress's server startup is slow -- even without a lot of the bulk for E2E. When we were using webpack, we appeared much faster by comparison. I think Cypress's slowness is more noticeable.

How has the user experience changed?

Users are able to test vite apps via @cypress/vite-dev-server. The tests for vite-dev-server dogfood themselves so the plugins file there can be used as reference.

  • Have tests been added/updated?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Feb 1, 2021

Thanks for taking the time to open a PR!

@JessicaSachs JessicaSachs requested a review from a team February 1, 2021 02:42
@lmiller1990
Copy link
Contributor

I just left comment (above, to do with merging in the latest feat/component-testing). I tried it out locally like you said in the PR description and it works fine - vite starts up very quickly, cypress feels like a snail in comparison!

This is great, I can't wait to try moving my example project to use this instead of webpack.

@cypress
Copy link

cypress bot commented Feb 1, 2021



Test summary

3974 0 52 1


Run details

Project cypress
Status Passed
Commit 1ef720c
Started Feb 10, 2021 9:34 PM
Ended Feb 10, 2021 9:45 PM
Duration 10:37 💡
OS Linux Debian - 10.5
Browser Firefox 77

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

@dmtrKovalenko
Copy link
Contributor

Is it possible at all to subscribe to hooks for rerunning specs/showing errors?

Copy link
Contributor

@dmtrKovalenko dmtrKovalenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making it not mergeable until rerunning and showing errors will be implemented

@JessicaSachs
Copy link
Contributor Author

@dmtrKovalenko

Making it not mergeable until rerunning and showing errors will be implemented

I don't know if this will be possible or easy right now. I want to merge it without these features. It is still valuable without them. We did not have these features for webpack for quite a while and it was fine.

@dmtrKovalenko
Copy link
Contributor

I read in docs that they have a plug-in system implemented. If not, of course it is valuable - I'll take a look tomorrow.

@JessicaSachs
Copy link
Contributor Author

@dmtrKovalenko they do have a plugin system implemented. We're using it already -- we're using the configureServer hook here. There are additional hooks. I need to read the source and play around to see what we have available to catch errors and pass them through the Cypress devServer EE.

We don't need to impl this to ship this plugin. It functionally works without passing errors to the UI.

dmtrKovalenko
dmtrKovalenko previously approved these changes Feb 2, 2021
Base automatically changed from feat/component-testing to develop February 4, 2021 20:45
@JessicaSachs JessicaSachs dismissed dmtrKovalenko’s stale review February 4, 2021 20:45

The base branch was changed.

@lmiller1990
Copy link
Contributor

@JessicaSachs can we move this to a new PR

Copy link
Contributor

@elevatebart elevatebart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good !!

@JessicaSachs JessicaSachs merged commit 0225406 into develop Feb 10, 2021
@JessicaSachs JessicaSachs deleted the feat/vite-plugin branch February 10, 2021 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants