Skip to content

Commit e8ad5c4

Browse files
Sync svelte docs (#756)
sync svelte docs Co-authored-by: Rich-Harris <[email protected]>
1 parent b886a23 commit e8ad5c4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

apps/svelte.dev/content/docs/svelte/07-misc/02-testing.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,19 @@ Then adjust your `vite.config.js`:
2121
/// file: vite.config.js
2222
import { defineConfig } from +++'vitest/config'+++;
2323

24-
export default defineConfig({ /* ... */ })
24+
export default defineConfig({
25+
// ...
26+
// Tell Vitest to use the `browser` entry points in `package.json` files, even though it's running in Node
27+
resolve: process.env.VITEST
28+
? {
29+
conditions: ['browser']
30+
}
31+
: undefined
32+
});
2533
```
2634

35+
> [!NOTE] If loading the browser version of all your packages is undesirable, because (for example) you also test backend libraries, [you may need to resort to an alias configuration](https://github.com/testing-library/svelte-testing-library/issues/222#issuecomment-1909993331)
36+
2737
You can now write unit tests for code inside your `.js/.ts` files:
2838

2939
```js

0 commit comments

Comments
 (0)