browsecraft-runner 0.1.0 → 0.1.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 +64 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# browsecraft-runner
|
|
2
|
+
|
|
3
|
+
Test runner and CLI for [Browsecraft](https://github.com/rik9564/browsecraft).
|
|
4
|
+
|
|
5
|
+
Discovers test files, coordinates execution, and reports results. Used internally by the `browsecraft` CLI.
|
|
6
|
+
|
|
7
|
+
Most users should install [`browsecraft`](https://www.npmjs.com/package/browsecraft) instead — it includes the runner automatically.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install browsecraft-runner
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { TestRunner } from 'browsecraft-runner';
|
|
19
|
+
|
|
20
|
+
const runner = new TestRunner({
|
|
21
|
+
config: {
|
|
22
|
+
browser: 'chrome',
|
|
23
|
+
headless: true,
|
|
24
|
+
timeout: 30000,
|
|
25
|
+
retries: 0,
|
|
26
|
+
testMatch: ['**/*.test.mjs'],
|
|
27
|
+
outputDir: 'test-results',
|
|
28
|
+
},
|
|
29
|
+
grep: 'login', // optional: filter tests by name
|
|
30
|
+
bail: false, // optional: stop on first failure
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const exitCode = await runner.run(loadFile, executeTest);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Features
|
|
37
|
+
|
|
38
|
+
- Test file discovery by glob patterns
|
|
39
|
+
- Grep filtering by test name
|
|
40
|
+
- `.only` support for focused tests
|
|
41
|
+
- Retry on failure
|
|
42
|
+
- Bail on first failure
|
|
43
|
+
- Color-coded console reporter
|
|
44
|
+
|
|
45
|
+
## Configuration
|
|
46
|
+
|
|
47
|
+
The runner accepts a `BrowsecraftConfig` object:
|
|
48
|
+
|
|
49
|
+
| Option | Type | Default | Description |
|
|
50
|
+
|--------|------|---------|-------------|
|
|
51
|
+
| `browser` | `string` | `'chrome'` | Browser to use (`chrome`, `firefox`, `edge`) |
|
|
52
|
+
| `headless` | `boolean` | `true` | Run in headless mode |
|
|
53
|
+
| `timeout` | `number` | `30000` | Test timeout in ms |
|
|
54
|
+
| `retries` | `number` | `0` | Retry failed tests |
|
|
55
|
+
| `testMatch` | `string[]` | `['**/*.test.*']` | Glob patterns for test files |
|
|
56
|
+
| `outputDir` | `string` | `'test-results'` | Output directory for artifacts |
|
|
57
|
+
| `viewport` | `object` | `{ width: 1280, height: 720 }` | Browser viewport size |
|
|
58
|
+
| `maximized` | `boolean` | `false` | Maximize the browser window |
|
|
59
|
+
| `baseURL` | `string` | — | Base URL for `page.goto()` |
|
|
60
|
+
| `workers` | `number` | `1` | Number of parallel workers |
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
[MIT](LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browsecraft-runner",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Test runner and CLI for Browsecraft",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"browsecraft-bidi": "0.1.
|
|
25
|
+
"browsecraft-bidi": "0.1.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.10.0",
|