fix: populate globalThis with defines in Vitest - #16224
fix: populate globalThis with defines in Vitest#16224elliott-with-the-longest-name-on-github wants to merge 4 commits into
globalThis with defines in Vitest#16224Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/dc7b03c2b9877f0052f393e3fe16720920f8fa7fOpen in |
|
|
@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 |
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
left a comment
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
|
figured it'd be easiest to just open a new PR: #16246 |
|
merged #16246, closing |
Closes #16214
Sets
defines onglobalThiswhen we detect that Vitest is running, since it "helpfully" deletes them for us.