You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -479,7 +479,7 @@ All examples so far have mentioned setting up tests against **pre-built dist out
479
479
1.`vi.mock()` cannot intercept imports made by your components, because the dependency is already bundled away before Vitest gets involved.
480
480
2. Coverage reports will not work out-of-the-box without additional configuration (`sourceMap: true` / [3rd party tools](https://github.com/cenfun/vitest-monocart-coverage)) and even then, may not be accurate.
481
481
482
-
The experimental `stencilVitestPlugin` solves this by hooking into Vite's transform pipeline: Stencil files are compiled on-the-fly before Vitest imports them; each component file becomes its own entry in Vitest's module graph — and its imports are independently resolvable and mockable.
482
+
The experimental `stencilVitestPlugin` solves this by hooking into Vite's transform pipeline: Stencil files are compiled on-the-fly before Vitest imports them; each component file becomes its own entry in Vitest's module graph - and its imports are independently resolvable and mockable.
// No dist setup file needed — each component source file registers
500
+
// No dist setup file needed - each component source file registers
501
501
502
502
environment: 'stencil',
503
503
// ^^ you can use the plugin with any setup - even browser tests!
@@ -535,7 +535,7 @@ It can then be imported and tested with mocked dependencies:
535
535
import { describe, it, expect, vi } from'vitest';
536
536
import { render, h } from'@stencil/vitest';
537
537
538
-
// vi.mock() is hoisted — the mock is in place before any imports resolve
538
+
// vi.mock() is hoisted - the mock is in place before any imports resolve
539
539
vi.mock('../utils/index.js', () => ({
540
540
capitalize: vi.fn((s:string) =>`[mocked:${s}]`),
541
541
}));
@@ -561,7 +561,7 @@ it('renders using the mocked utility', async () => {
561
561
In Stencil v4 `transpile()` (used within the plugin) is a single-file compiler. When a component class `extends` a base class that lives in a separate file, `transpile()` cannot follow the import to merge the parent's metadata and will throw an error.
0 commit comments