@testing-library/svelte
Advanced tools
Comparing version 5.0.1 to 5.1.0
{ | ||
"name": "@testing-library/svelte", | ||
"version": "5.0.1", | ||
"version": "5.1.0", | ||
"description": "Simple and complete Svelte testing utilities that encourage good testing practices.", | ||
@@ -17,2 +17,6 @@ "main": "src/index.js", | ||
"default": "./src/vitest.js" | ||
}, | ||
"./vite": { | ||
"types": "./types/vite.d.ts", | ||
"default": "./src/vite.js" | ||
} | ||
@@ -47,4 +51,6 @@ }, | ||
"files": [ | ||
"src/", | ||
"types/index.d.ts" | ||
"src", | ||
"types", | ||
"!*.test-d.ts", | ||
"!__tests__" | ||
], | ||
@@ -73,4 +79,14 @@ "scripts": { | ||
"peerDependencies": { | ||
"svelte": "^3 || ^4 || ^5" | ||
"svelte": "^3 || ^4 || ^5", | ||
"vite": "*", | ||
"vitest": "*" | ||
}, | ||
"peerDependenciesMeta": { | ||
"vite": { | ||
"optional": true | ||
}, | ||
"vitest": { | ||
"optional": true | ||
} | ||
}, | ||
"dependencies": { | ||
@@ -77,0 +93,0 @@ "@testing-library/dom": "^9.3.1" |
@@ -16,3 +16,3 @@ <div align="center"> | ||
[**Read The Docs**](https://testing-library.com/docs/svelte-testing-library/intro) | | ||
[Edit the docs](https://github.com/alexkrolick/testing-library-docs) | ||
[Edit the docs](https://github.com/testing-library/testing-library-docs) | ||
@@ -84,15 +84,38 @@ <!-- prettier-ignore-start --> | ||
## Setup | ||
We recommend using `@testing-library/svelte` with [Vitest][] as your test runner. To get started, add the `svelteTesting` plugin to your Vite or Vitest config. | ||
```diff | ||
// vite.config.js | ||
import { svelte } from '@sveltejs/vite-plugin-svelte' | ||
+ import { svelteTesting } from '@testing-library/svelte/vite' | ||
export default defineConfig({ | ||
plugins: [ | ||
svelte(), | ||
+ svelteTesting(), | ||
] | ||
}); | ||
``` | ||
See the [setup docs][] for more detailed setup instructions, including for other test runners like Jest. | ||
[vitest]: https://vitest.dev/ | ||
[setup docs]: https://testing-library.com/docs/svelte-testing-library/setup | ||
### Svelte 5 support | ||
If you are riding the bleeding edge of Svelte 5, you'll need to either | ||
import from `@testing-library/svelte/svelte5` instead of `@testing-library/svelte`, or have your `vite.config.js` contains the following alias: | ||
import from `@testing-library/svelte/svelte5` instead of `@testing-library/svelte`, or add an alias to your `vite.config.js`: | ||
``` | ||
export default defineConfig(({ }) => ({ | ||
```js | ||
export default defineConfig({ | ||
plugins: [svelte(), svelteTesting()], | ||
test: { | ||
alias: { | ||
'@testing-library/svelte': '@testing-library/svelte/svelte5' | ||
} | ||
'@testing-library/svelte': '@testing-library/svelte/svelte5', | ||
}, | ||
}, | ||
})) | ||
}) | ||
``` | ||
@@ -99,0 +122,0 @@ |
import '@testing-library/jest-dom/vitest' | ||
import '../vitest' |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46512
32
728
233
4
4