vite-plugin-intellitester 0.1.12
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 +169 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# vite-plugin-autotester
|
|
2
|
+
|
|
3
|
+
Vite plugin for integrating AutoTester into your Vite projects. Automatically generates test stubs, provides a dev server endpoint for test management, and integrates with AutoTester's testing capabilities.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Automatic Test Stub Generation**: Scans your components and generates YAML test stubs
|
|
8
|
+
- **Dev Server Integration**: Adds a `/__autotester` endpoint to view and manage tests
|
|
9
|
+
- **Hot Module Replacement**: Watches test files and re-runs tests on changes
|
|
10
|
+
- **Build Integration**: Optionally run tests after build completion
|
|
11
|
+
- **TypeScript Support**: Full TypeScript definitions included
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install vite-plugin-autotester
|
|
17
|
+
# or
|
|
18
|
+
pnpm add vite-plugin-autotester
|
|
19
|
+
# or
|
|
20
|
+
yarn add vite-plugin-autotester
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
Add the plugin to your `vite.config.ts`:
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { defineConfig } from 'vite';
|
|
29
|
+
import { autotester } from 'vite-plugin-autotester';
|
|
30
|
+
|
|
31
|
+
export default defineConfig({
|
|
32
|
+
plugins: [
|
|
33
|
+
autotester({
|
|
34
|
+
// Scan these patterns for components to generate test stubs
|
|
35
|
+
include: ['src/components/**/*.tsx', 'src/pages/**/*.tsx'],
|
|
36
|
+
|
|
37
|
+
// Directory for test files
|
|
38
|
+
testsDir: './tests',
|
|
39
|
+
|
|
40
|
+
// Watch test files in dev mode
|
|
41
|
+
watchTests: true,
|
|
42
|
+
|
|
43
|
+
// Run tests after build
|
|
44
|
+
runOnBuild: false,
|
|
45
|
+
|
|
46
|
+
// Path to AutoTester config
|
|
47
|
+
configPath: 'autotester.config.yaml',
|
|
48
|
+
}),
|
|
49
|
+
],
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Configuration Options
|
|
54
|
+
|
|
55
|
+
### `include`
|
|
56
|
+
- **Type**: `string[]`
|
|
57
|
+
- **Default**: `[]`
|
|
58
|
+
- **Description**: Glob patterns for components to scan and generate test stubs for
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
include: ['src/components/**/*.tsx', 'src/pages/**/*.tsx']
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### `testsDir`
|
|
65
|
+
- **Type**: `string`
|
|
66
|
+
- **Default**: `'./tests'`
|
|
67
|
+
- **Description**: Directory where test files are stored
|
|
68
|
+
|
|
69
|
+
### `watchTests`
|
|
70
|
+
- **Type**: `boolean`
|
|
71
|
+
- **Default**: `true`
|
|
72
|
+
- **Description**: Whether to watch test files and re-run tests in dev mode
|
|
73
|
+
|
|
74
|
+
### `runOnBuild`
|
|
75
|
+
- **Type**: `boolean`
|
|
76
|
+
- **Default**: `false`
|
|
77
|
+
- **Description**: Whether to run tests after build completes
|
|
78
|
+
|
|
79
|
+
### `configPath`
|
|
80
|
+
- **Type**: `string`
|
|
81
|
+
- **Default**: `'autotester.config.yaml'`
|
|
82
|
+
- **Description**: Path to autotester.config.yaml
|
|
83
|
+
|
|
84
|
+
### `endpoint`
|
|
85
|
+
- **Type**: `string`
|
|
86
|
+
- **Default**: `'/__autotester'`
|
|
87
|
+
- **Description**: Base URL for the dev server endpoint
|
|
88
|
+
|
|
89
|
+
## Dev Server Endpoint
|
|
90
|
+
|
|
91
|
+
When running the Vite dev server, navigate to `http://localhost:5173/__autotester` (or your configured port) to view:
|
|
92
|
+
|
|
93
|
+
- Test configuration status
|
|
94
|
+
- Available test files
|
|
95
|
+
- Test execution options
|
|
96
|
+
|
|
97
|
+
## Test Stub Generation
|
|
98
|
+
|
|
99
|
+
The plugin automatically generates test stubs for components matching your `include` patterns. Each stub follows AutoTester's YAML format:
|
|
100
|
+
|
|
101
|
+
```yaml
|
|
102
|
+
name: Button Component Test
|
|
103
|
+
platform: web
|
|
104
|
+
|
|
105
|
+
config:
|
|
106
|
+
web:
|
|
107
|
+
baseUrl: http://localhost:5173
|
|
108
|
+
headless: false
|
|
109
|
+
timeout: 30000
|
|
110
|
+
|
|
111
|
+
steps:
|
|
112
|
+
- type: navigate
|
|
113
|
+
value: /
|
|
114
|
+
|
|
115
|
+
- type: screenshot
|
|
116
|
+
name: button-initial-state
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Note**: Test stubs are only created if they don't already exist. The plugin will not overwrite your customized tests.
|
|
120
|
+
|
|
121
|
+
## Requirements
|
|
122
|
+
|
|
123
|
+
- Vite 5.x, 6.x, or 7.x
|
|
124
|
+
- Node.js 18+
|
|
125
|
+
- TypeScript 5+ (recommended)
|
|
126
|
+
|
|
127
|
+
## Integration with AutoTester
|
|
128
|
+
|
|
129
|
+
This plugin works alongside the AutoTester CLI. To run your tests:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Install AutoTester
|
|
133
|
+
npm install autotester
|
|
134
|
+
|
|
135
|
+
# Run all tests
|
|
136
|
+
npx autotester run
|
|
137
|
+
|
|
138
|
+
# Run a specific test
|
|
139
|
+
npx autotester run tests/Button.test.yaml
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Example Project Structure
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
my-vite-app/
|
|
146
|
+
├── src/
|
|
147
|
+
│ ├── components/
|
|
148
|
+
│ │ ├── Button.tsx
|
|
149
|
+
│ │ └── Input.tsx
|
|
150
|
+
│ └── pages/
|
|
151
|
+
│ └── Home.tsx
|
|
152
|
+
├── tests/
|
|
153
|
+
│ ├── components/
|
|
154
|
+
│ │ ├── Button.test.yaml # Auto-generated
|
|
155
|
+
│ │ └── Input.test.yaml # Auto-generated
|
|
156
|
+
│ └── pages/
|
|
157
|
+
│ └── Home.test.yaml # Auto-generated
|
|
158
|
+
├── autotester.config.yaml
|
|
159
|
+
├── vite.config.ts
|
|
160
|
+
└── package.json
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
MIT
|
|
166
|
+
|
|
167
|
+
## Author
|
|
168
|
+
|
|
169
|
+
Zach Handley <zachhandley@gmail.com>
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vite-plugin-intellitester",
|
|
3
|
+
"version": "0.1.12",
|
|
4
|
+
"description": "Vite plugin for integrating IntelliTester into Vite projects",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://forge.blackleafdigital.com/zachhandley/Intellitester.git",
|
|
20
|
+
"directory": "packages/vite-plugin-autotester"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/ZachHandley/Intellitester",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/ZachHandley/Intellitester/issues"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"vite",
|
|
28
|
+
"plugin",
|
|
29
|
+
"testing",
|
|
30
|
+
"intellitester",
|
|
31
|
+
"e2e"
|
|
32
|
+
],
|
|
33
|
+
"author": "Zach Handley <zachhandley@gmail.com> (https://zachhandley.com)",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"fast-glob": "^3.3.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^25.0.2",
|
|
43
|
+
"typescript": "^5.9.3",
|
|
44
|
+
"vite": "^7.2.7"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsc",
|
|
48
|
+
"typecheck": "tsc --noEmit"
|
|
49
|
+
}
|
|
50
|
+
}
|