vitest-browser-angular 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,6 +53,29 @@ test('mount', async ({ mount }) => {
|
|
|
53
53
|
});
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
## Extending Vitest Context
|
|
57
|
+
|
|
58
|
+
If you want to extend the library's test context (fixtures) like this:
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
import { test as testBase } from 'vitest-browser-angular'
|
|
62
|
+
|
|
63
|
+
export const test = testBase.extend(...)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Make sure you add `vitest-browser-angular` to the `types` array in your `tsconfig.json`
|
|
67
|
+
|
|
68
|
+
If it doesn't work, you probably forgot to add `@vitest/browser` to the `types` array as well.
|
|
69
|
+
|
|
70
|
+
**Example:**
|
|
71
|
+
```json
|
|
72
|
+
|
|
73
|
+
"types": [
|
|
74
|
+
"@vitest/browser",
|
|
75
|
+
"vitest-browser-angular"
|
|
76
|
+
]
|
|
77
|
+
```
|
|
78
|
+
|
|
56
79
|
## Contributing
|
|
57
80
|
|
|
58
81
|
Want to contribute? Yayy! 🎉
|
|
@@ -79,4 +102,4 @@ This project is inspired by the following projects:
|
|
|
79
102
|
|
|
80
103
|
## License
|
|
81
104
|
|
|
82
|
-
MIT
|
|
105
|
+
MIT
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -17,13 +17,16 @@ const test = test$1.extend({
|
|
|
17
17
|
const imports = [componentClass, ...config?.imports || []];
|
|
18
18
|
const providers = [...config?.providers || []];
|
|
19
19
|
const mountResult = {};
|
|
20
|
-
if (config?.withRouting)
|
|
20
|
+
if (config?.withRouting) {
|
|
21
|
+
const routes = typeof config.withRouting === "boolean" ? [] : config.withRouting.routes;
|
|
22
|
+
providers.push(provideRouter(routes));
|
|
23
|
+
}
|
|
21
24
|
TestBed.configureTestingModule({
|
|
22
25
|
imports,
|
|
23
26
|
providers
|
|
24
27
|
});
|
|
25
28
|
if (config?.withRouting) {
|
|
26
|
-
const routerHarness = await RouterTestingHarness.create(config.withRouting.initialRoute);
|
|
29
|
+
const routerHarness = await RouterTestingHarness.create(typeof config.withRouting === "boolean" ? void 0 : config.withRouting.initialRoute);
|
|
27
30
|
mountResult.routerHarness = routerHarness;
|
|
28
31
|
mountResult.router = TestBed.inject(Router);
|
|
29
32
|
}
|