Skip to content

Test improvements #213

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

Closed
Rich-Harris opened this issue Dec 2, 2020 · 2 comments
Closed

Test improvements #213

Rich-Harris opened this issue Dec 2, 2020 · 2 comments
Milestone

Comments

@Rich-Harris
Copy link
Member

Couple of things that should follow #211 that I noticed while working on it:

  • We shouldn't be using waitFor APIs, as they make tests inherently imprecise
  • We need a way to test the SSR output, pre-hydration, and the post-hydration state of the page
@ehrencrona
Copy link
Contributor

For the second point, what the sapper tests do is to call start manually. This was easy to override in client.js, but now start is instead called inside a script block rendered in framework code.

The simplest solution I could think of was to add something like preventStart to the render options, which would suppress the start (and probably also store start in a global variable so it can be called by the tests). Do you think it would be a viable solution?

@Rich-Harris
Copy link
Member Author

Yeah, I was trying to think of a way that didn't feel like too much of a hack, but the simplest solution for now is something like that. Perhaps a startGlobal option in svelte.config.js that, if present, turns

start(...)

into

window.${options.startGlobal} = () => start(...)

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

No branches or pull requests

2 participants