-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
chore: uvu -> vitest for create-svelte tests #9910
Changes from 3 commits
84cd007
86654f0
fa39230
9e1351f
0a50beb
14f524c
aa188d4
3d2e439
fbfe576
240a14f
b36ad22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { defineConfig } from 'vitest/config'; | ||
|
||
export default defineConfig({ | ||
test: { dir: './test', include: ['*.js'] } | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -174,10 +174,10 @@ test('warns if cookie exceeds 4,129 bytes', () => { | |
const error = /** @type {Error} */ (e); | ||
|
||
assert.equal(error.message, `Cookie "a" is too large, and will be discarded by the browser`); | ||
} finally { | ||
// @ts-expect-error | ||
globalThis.__SVELTEKIT_DEV__ = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In
I did that to speed up the tests, but I'm realizing if we're modifying global variables like this then that's probably not safe to do, so we should probably remove them There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this has its own There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it does have its own There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah right. can we mark a single file as requiring isolation? probably should discuss this in a separate PR There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
// @ts-expect-error | ||
globalThis.__SVELTEKIT_DEV__ = false; | ||
}); | ||
|
||
test('get all cookies from header and set calls', () => { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be nice to pass in
overrides
vs depending on a global variable. would also need to tweak where it's being called thenThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but they are global, or rather shared by everything in the module. not sure what this would achieve —
overrides
would still be defined/populated at the module level, we'd just be replacing a closed-over value with an identical parameter, no?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. I just think it's a bit cleaner to avoid depending on global values - e.g. if you wanted to have a unit test for the method it's easier that way. no functional difference though and just a matter of opinion