fix: ensure fireEvent is exported #339
Merged
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.
Overview
#328 moved exports from
pure.jstoindex.jsand switched everything to wildcard exports:svelte-testing-library/src/index.js
Lines 15 to 16 in 0593819
If two wildcard exports emit the same export, neither will be included.
This means the current release on
nextis not exportingfireEvent. This PR moves the STL exports back to named exports to resolve the bugObserving the bug
Why didn't tests catch this?
Vite/Vitest appears to resolve exports differently from local files compared to
node_modules. Since the test suite imports directly fromsrc/index.js, the behavior is slightly different:fireEventis availableIn our case, since
export * from '@testing-library/dom'is listed second, that means the tests are running with the vanillafireEvent, and coincidentally passing because a no-opawaitin the test was enough of a wait for Svelte to flush pending changes.Without a more sophisticated test suite that packs and installs the library into example projects (which is a good long term idea!) this particular problem is hard to guard against with unit tests.
Change log
fireEventis returning a Promise