-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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: fix $props.id
tests
#15294
chore: fix $props.id
tests
#15294
Conversation
|
|
What if we instead exposed some mechanism for resetting the counter at the start of each test, similar to the (badly named) |
Mh...yeah that's a good idea. Will do in a min |
I didn't known how test works exactly, but in theory the id should be reset on each call to
Yes server-side id starts with 's', and client-side starts with 'c'... |
Seems to work fine...also on the server there was not such problem because it reset on every I've only added it to runtime runes, do you think we should also add this to other test suites? |
See that you found the problem. 👍 Also, by rereading the code I saw that I had added an svelte/packages/svelte/src/internal/server/index.js Lines 100 to 104 in 32b78c9
I totally forgot to mention it on the PR, and now I think that it is useless and should not be there. |
Uh I was wondering about that too...yeah I think it's fine to remove it if you can open a pr |
Currently tests for
$props.id
are a bit brittle because the id will be shared between all tests...this means that if we add a new test that uses$props.id
before the current test the old test will fail for apparently no reason. This can be very confusing so we definitely need to fix this.I changed the test to make sure that all the ids are different and in hydrate mode i've also cut the numbers out and checked that the first ones starts with
s
meaning they are the same as the server. I don't know if this is the right approach but it's the only one i could think of to actually test that the values comes from the server.cc @adiguba maybe is worth for you to take a look at this.
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.packages/svelte/src
, add a changeset (npx changeset
).Tests and linting
pnpm test
and lint the project withpnpm lint