fix: populate globalThis with defines in Vitest#16224
Open
elliott-with-the-longest-name-on-github wants to merge 3 commits into
Open
fix: populate globalThis with defines in Vitest#16224elliott-with-the-longest-name-on-github wants to merge 3 commits into
globalThis with defines in Vitest#16224elliott-with-the-longest-name-on-github wants to merge 3 commits into
Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/be586f39b6461f43cd834d272782d5491dfcf704Open in |
🦋 Changeset detectedLatest commit: be586f3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Author
|
@MaddyGuthridge can you install using the pkg.svelte.dev link above and let me know if it fixes your issue? I think it should... |
|
I'll give this a go after work today |
Rich-Harris
reviewed
Jul 3, 2026
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
|
I've tried it out, but had some issues:
$ npm t
> kit-template-default@0.0.1 test
> vitest run
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Startup Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
SyntaxError: Unexpected token 'g', "globalThis"... is not valid JSON
at JSON.parse (<anonymous>)
at BasicMinimalPluginContext.handler (file:///home/maddy/Downloads/sveltejs-kit-template-default-fann5ee8/node_modules/@sveltejs/kit/src/exports/vite/index.js:506:67)
at async runConfigHook (file:///home/maddy/Downloads/sveltejs-kit-template-default-fann5ee8/node_modules/vite/dist/node/chunks/node.js:35760:15)
at async resolveConfig (file:///home/maddy/Downloads/sveltejs-kit-template-default-fann5ee8/node_modules/vite/dist/node/chunks/node.js:35195:11)
at async _createServer (file:///home/maddy/Downloads/sveltejs-kit-template-default-fann5ee8/node_modules/vite/dist/node/chunks/node.js:25332:65)
at async createViteServer (file:///home/maddy/Downloads/sveltejs-kit-template-default-fann5ee8/node_modules/vitest/dist/chunks/cli-api.24X8XwN1.js:8835:17)
at async createVitest (file:///home/maddy/Downloads/sveltejs-kit-template-default-fann5ee8/node_modules/vitest/dist/chunks/cli-api.24X8XwN1.js:14221:18)
at async prepareVitest (file:///home/maddy/Downloads/sveltejs-kit-template-default-fann5ee8/node_modules/vitest/dist/chunks/cli-api.24X8XwN1.js:14588:14)
at async startVitest (file:///home/maddy/Downloads/sveltejs-kit-template-default-fann5ee8/node_modules/vitest/dist/chunks/cli-api.24X8XwN1.js:14531:14)
at async start (file:///home/maddy/Downloads/sveltejs-kit-template-default-fann5ee8/node_modules/vitest/dist/chunks/cac.D3xHeqeL.js:2340:15) |
dummdidumm
approved these changes
Jul 3, 2026
dummdidumm
requested changes
Jul 3, 2026
dummdidumm
left a comment
Member
There was a problem hiding this comment.
this should target main (I briefly tried through the UI but that will try to add all of version-3, too), otherwise lgtm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #16214
Sets
defines onglobalThiswhen we detect that Vitest is running, since it "helpfully" deletes them for us.