File tree Expand file tree Collapse file tree 3 files changed +32
-4
lines changed Expand file tree Collapse file tree 3 files changed +32
-4
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,21 @@ This library has `peerDependencies` listings for `svelte >= 3`.
80
80
You may also be interested in installing ` @testing-library/jest-dom ` so you can use
81
81
[ the custom jest matchers] ( https://github.com/testing-library/jest-dom ) .
82
82
83
+ ### Svelte 5 support
84
+
85
+ If you are riding the bleeding edge of Svelte 5, you'll need to either
86
+ import from ` @testing-library/svelte/svelte5 ` instead of ` @testing-library/svelte ` , or have your ` vite.config.js ` contains the following alias:
87
+
88
+ ```
89
+ export default defineConfig(({ }) => ({
90
+ test: {
91
+ alias: {
92
+ './pure.js': './svelte5.js'
93
+ }
94
+ },
95
+ }))
96
+ ```
97
+
83
98
## Docs
84
99
85
100
See the [ ** docs** ] ( https://testing-library.com/docs/svelte-testing-library/intro ) over at the Testing Library website.
Original file line number Diff line number Diff line change 4
4
"description" : " Simple and complete Svelte testing utilities that encourage good testing practices." ,
5
5
"main" : " src/index.js" ,
6
6
"exports" : {
7
- "." : {
8
- "types" : " ./types/index.d.ts" ,
9
- "default" : " ./src/index.js"
10
- },
7
+ "." : " ./src/index.js" ,
8
+ "./svelte5" : " ./src/svelte5-index.js" ,
11
9
"./vitest" : {
12
10
"default" : " ./src/vitest.js"
13
11
}
Original file line number Diff line number Diff line change
1
+ import { act , cleanup } from './svelte5.js'
2
+
3
+ // If we're running in a test runner that supports afterEach
4
+ // then we'll automatically run cleanup afterEach test
5
+ // this ensures that tests run in isolation from each other
6
+ // if you don't like this then either import the `pure` module
7
+ // or set the STL_SKIP_AUTO_CLEANUP env variable to 'true'.
8
+ if ( typeof afterEach === 'function' && ! process . env . STL_SKIP_AUTO_CLEANUP ) {
9
+ afterEach ( async ( ) => {
10
+ await act ( )
11
+ cleanup ( )
12
+ } )
13
+ }
14
+
15
+ export * from './svelte5.js'
You can’t perform that action at this time.
0 commit comments