vitest-browser-angular 0.0.0 → 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 HiRez.io
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -2,3 +2,81 @@
2
2
 
3
3
  Mount Angular components in VItest Browser Mode.
4
4
 
5
+ ## Installation
6
+
7
+ ```sh
8
+ pnpm add -D vitest-browser-angular
9
+ ```
10
+
11
+ ## Setup Test Environment with Zone.js
12
+
13
+ ```ts
14
+ // vitest.config.ts
15
+
16
+ export default defineConfig({
17
+ test: {
18
+ globals: true,
19
+
20
+ // 👇 This is what you need to add
21
+ setupFiles: ['vitest-browser-angular/setup-zones'],
22
+
23
+ browser: {
24
+ enabled: true,
25
+ provider: 'playwright',
26
+ instances: [{ browser: 'chromium' }],
27
+ },
28
+ },
29
+ });
30
+ ```
31
+
32
+ ## Setup Test Environment with Zoneless
33
+
34
+ TBD
35
+
36
+ ## Usage
37
+
38
+ ```ts
39
+
40
+ import { test, expect } from 'vitest-browser-angular';
41
+
42
+ @Component({
43
+ template: '<h1>{{ title }}</h1>',
44
+ })
45
+ export class HelloWorldComponent {
46
+ title = 'Hello World';
47
+ }
48
+
49
+
50
+ test('mount', async ({ mount }) => {
51
+ const { component } = await mount(HelloWorldComponent);
52
+ await expect.element(component).toHaveTextContent('Hello World');
53
+ });
54
+ ```
55
+
56
+ ## Contributing
57
+
58
+ Want to contribute? Yayy! 🎉
59
+
60
+ Please read and follow our [Contributing Guidelines](CONTRIBUTING.md) to learn what are the right steps to take before contributing your time, effort and code.
61
+
62
+ Thanks 🙏
63
+
64
+ <br/>
65
+
66
+ ## Code Of Conduct
67
+
68
+ Be kind to each other and please read our [code of conduct](CODE_OF_CONDUCT.md).
69
+
70
+ <br/>
71
+
72
+
73
+ ## Credits
74
+
75
+ This project is inspired by the following projects:
76
+
77
+ [vitest-browser-vue](https://github.com/vitest-dev/vitest-browser-vue)
78
+ [angular-testing-library](https://github.com/testing-library/angular-testing-library)
79
+
80
+ ## License
81
+
82
+ MIT
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { Router, Routes } from "@angular/router";
3
3
  import { RouterTestingHarness } from "@angular/router/testing";
4
4
  import { BrowserPage, Locator } from "@vitest/browser/context";
5
5
  import * as vitest0 from "vitest";
6
- import { Type } from "@angular/core";
6
+ import { EnvironmentProviders, Provider, Type } from "@angular/core";
7
7
  export * from "vitest";
8
8
 
9
9
  //#region src/index.d.ts
@@ -13,8 +13,8 @@ interface RoutingConfig {
13
13
  }
14
14
  interface MountConfig {
15
15
  withRouting?: RoutingConfig;
16
- providers?: any[];
17
- imports?: any[];
16
+ providers?: Array<Provider | EnvironmentProviders>;
17
+ imports?: unknown[];
18
18
  }
19
19
  interface MountResult<T> {
20
20
  fixture: ComponentFixture<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest-browser-angular",
3
- "version": "0.0.0",
3
+ "version": "0.0.1",
4
4
  "description": "Mount Angular components in VItest Browser Mode",
5
5
  "author": "Shai Reznik (HiRez.io)",
6
6
  "license": "MIT",
@@ -40,13 +40,6 @@
40
40
  "engines": {
41
41
  "node": "^18.0.0 || ^20.0.0 || >=22.0.0"
42
42
  },
43
- "scripts": {
44
- "build": "tsdown",
45
- "dev": "tsdown --watch --sourcemap",
46
- "test": "vitest",
47
- "lint": "eslint --cache .",
48
- "lint:fix": "pnpm lint --fix"
49
- },
50
43
  "peerDependencies": {
51
44
  "@analogjs/vitest-angular": "^1.20.0",
52
45
  "@angular/compiler": "^20.0.0",
@@ -65,11 +58,14 @@
65
58
  "@changesets/cli": "^2.29.6",
66
59
  "@changesets/get-github-info": "^0.6.0",
67
60
  "@changesets/types": "^6.1.0",
61
+ "@eslint/js": "^9.35.0",
68
62
  "@vitest/browser": "^3.2.0",
69
63
  "bumpp": "^9.4.2",
70
64
  "changelogithub": "^0.13.9",
65
+ "dotenv": "^17.2.2",
71
66
  "eslint": "^9.8.0",
72
67
  "eslint-config-prettier": "^10.1.8",
68
+ "globals": "^16.3.0",
73
69
  "playwright": "^1.46.0",
74
70
  "prettier": "^3.6.2",
75
71
  "pretty-quick": "^4.2.2",
@@ -78,8 +74,25 @@
78
74
  "tsup": "^8.2.4",
79
75
  "tsx": "^4.17.0",
80
76
  "typescript": "^5.5.4",
77
+ "typescript-eslint": "^8.42.0",
81
78
  "vitest": "^3.2.0",
82
79
  "zone.js": "^0.15.1",
83
80
  "zx": "^8.1.4"
81
+ },
82
+ "simple-git-hooks": {
83
+ "pre-commit": "pnpm fmt.staged && pnpm lint"
84
+ },
85
+ "scripts": {
86
+ "build": "tsdown",
87
+ "change": "changeset",
88
+ "dev": "tsdown --watch --sourcemap",
89
+ "fmt": "prettier --write .",
90
+ "fmt.check": "prettier --check .",
91
+ "fmt.staged": "pretty-quick --staged",
92
+ "lint": "eslint --cache .",
93
+ "lint:fix": "pnpm lint --fix",
94
+ "release": "changeset publish",
95
+ "release.pkg-pr-new": "pnpm dlx pkg-pr-new publish",
96
+ "test": "vitest"
84
97
  }
85
- }
98
+ }