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

Fix Svelte plugin SSR bug; add test #1241

Merged
merged 1 commit into from
Oct 7, 2020
Merged

Conversation

drwpow
Copy link
Collaborator

@drwpow drwpow commented Oct 7, 2020

Changes

Fixes the SSR bug introduced in #1221 where a user’s generate settings were always overridden. Adds a test to help with regressions.

Testing

Tests were added! Tests should pass.

Testing this manually is a bit arduous; please comment if you’d like a walkthrough of this setup.

Docs

No docs needed; bugfix + test only

@drwpow drwpow requested a review from FredKSchott October 7, 2020 16:28
@drwpow drwpow requested a review from a team as a code owner October 7, 2020 16:28
@vercel
Copy link

vercel bot commented Oct 7, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/pikapkg/snowpack/4vh43ujip
✅ Preview: https://snowpack-git-drwpow-svelte-plugin-test.pikapkg.vercel.app

const userSvelteConfigLoc = path.join(process.cwd(), 'svelte.config.js');
// Note(drew): __config is for internal testing use; maybe we should make this public at some point?
const userSvelteConfigLoc =
pluginOptions.__config || path.join(process.cwd(), 'svelte.config.js');
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added a config option so that the preprocessor could be tested. Should this be public?

Copy link
Owner

Choose a reason for hiding this comment

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

Yea, not opposed to supporting a simple JSON object (or JS object) via plugin options, in a follow up PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Cool. Yeah let me think about it (I actually had trouble finding out about svelte.config.js being a thing)


it('passes options to compiler', () => {
const options = {
generate: 'ssr',
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the main bug we’re testing for: generate: 'ssr' wasn‘t being passed to the plugin. This test failed before the change.

Copy link
Owner

@FredKSchott FredKSchott left a comment

Choose a reason for hiding this comment

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

LGTM! 1 small comment

plugins/plugin-svelte/plugin.js Outdated Show resolved Hide resolved
const userSvelteConfigLoc = path.join(process.cwd(), 'svelte.config.js');
// Note(drew): __config is for internal testing use; maybe we should make this public at some point?
const userSvelteConfigLoc =
pluginOptions.__config || path.join(process.cwd(), 'svelte.config.js');
Copy link
Owner

Choose a reason for hiding this comment

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

Yea, not opposed to supporting a simple JSON object (or JS object) via plugin options, in a follow up PR.

@drwpow drwpow force-pushed the drwpow/svelte-plugin-test branch from 9c4ff53 to bdef3c5 Compare October 7, 2020 19:55
@drwpow drwpow merged commit 1faf063 into master Oct 7, 2020
@drwpow drwpow deleted the drwpow/svelte-plugin-test branch October 7, 2020 20:19
@gr2m
Copy link
Contributor

gr2m commented Oct 8, 2020

The new tests currently seem to fail on Windows:
https://github.com/pikapkg/snowpack/pull/1171/checks?check_run_id=1227762075#step:4:75

@FredKSchott
Copy link
Owner

@gr2m traced it to a bad async test introduced in the sass plugin, fix is #1257

FredKSchott referenced this pull request Oct 8, 2020
…it found (#1233)

* writing the first docs test and fixing the errors it found

* Creating a GitHub Action

* Update docs.yml

* fixes to the test runner and actions

* removing jest from docs
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.

3 participants