@pilaf/cli 1.0.0 → 1.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/README.md +164 -0
- package/package.json +8 -4
package/README.md
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# @pilaf/cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for Pilaf testing framework.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Install globally
|
|
9
|
+
pnpm add -g @pilaf/cli
|
|
10
|
+
|
|
11
|
+
# Or install locally
|
|
12
|
+
pnpm add -D @pilaf/cli
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Run all Pilaf tests
|
|
19
|
+
pilaf test
|
|
20
|
+
|
|
21
|
+
# Run specific test file
|
|
22
|
+
pilaf test path/to/test.pilaf.test.js
|
|
23
|
+
|
|
24
|
+
# Run with verbose output
|
|
25
|
+
pilaf test --verbose
|
|
26
|
+
|
|
27
|
+
# Generate HTML report
|
|
28
|
+
pilaf report
|
|
29
|
+
|
|
30
|
+
# Show help
|
|
31
|
+
pilaf --help
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Configuration
|
|
35
|
+
|
|
36
|
+
Pilaf looks for a `pilaf.config.js` file in your project root:
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
// pilaf.config.js
|
|
40
|
+
module.exports = {
|
|
41
|
+
backend: {
|
|
42
|
+
rcon: {
|
|
43
|
+
host: 'localhost',
|
|
44
|
+
port: 25575,
|
|
45
|
+
password: process.env.RCON_PASSWORD || 'dragon'
|
|
46
|
+
},
|
|
47
|
+
mineflayer: {
|
|
48
|
+
host: 'localhost',
|
|
49
|
+
port: 25565,
|
|
50
|
+
auth: 'offline'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
testMatch: ['**/*.pilaf.test.js', '**/*.story.test.js'],
|
|
54
|
+
testIgnore: ['**/node_modules/**', '**/dist/**'],
|
|
55
|
+
reportDir: 'target/pilaf-reports',
|
|
56
|
+
timeout: 30000,
|
|
57
|
+
retries: 0,
|
|
58
|
+
verbose: false
|
|
59
|
+
};
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Environment Variables
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# RCON Connection
|
|
66
|
+
RCON_HOST=localhost
|
|
67
|
+
RCON_PORT=25575
|
|
68
|
+
RCON_PASSWORD=your_password
|
|
69
|
+
|
|
70
|
+
# Minecraft Server
|
|
71
|
+
MC_HOST=localhost
|
|
72
|
+
MC_PORT=25565
|
|
73
|
+
|
|
74
|
+
# Authentication
|
|
75
|
+
MC_AUTH=offline # or 'microsoft'
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Commands
|
|
79
|
+
|
|
80
|
+
### `pilaf test [files...]`
|
|
81
|
+
|
|
82
|
+
Run Pilaf tests.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Run all tests
|
|
86
|
+
pilaf test
|
|
87
|
+
|
|
88
|
+
# Run specific file
|
|
89
|
+
pilaf test tests/basic-rcon.pilaf.test.js
|
|
90
|
+
|
|
91
|
+
# Run with pattern
|
|
92
|
+
pilaf test tests/**/*.pilaf.test.js
|
|
93
|
+
|
|
94
|
+
# Verbose mode
|
|
95
|
+
pilaf test --verbose
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### `pilaf report`
|
|
99
|
+
|
|
100
|
+
Generate HTML report from test results.
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pilaf report
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Report is saved to `target/pilaf-reports/index.html` by default.
|
|
107
|
+
|
|
108
|
+
### `pilaf init`
|
|
109
|
+
|
|
110
|
+
Initialize Pilaf configuration in your project.
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
pilaf init
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Creates `pilaf.config.js` with default settings.
|
|
117
|
+
|
|
118
|
+
## Examples
|
|
119
|
+
|
|
120
|
+
Create a test file `my-plugin.test.js`:
|
|
121
|
+
|
|
122
|
+
```javascript
|
|
123
|
+
const { describe, it, expect } = require('@jest/globals');
|
|
124
|
+
const { StoryRunner } = require('@pilaf/framework');
|
|
125
|
+
|
|
126
|
+
describe('My Plugin', () => {
|
|
127
|
+
it('should do something', async () => {
|
|
128
|
+
const runner = new StoryRunner();
|
|
129
|
+
|
|
130
|
+
const result = await runner.execute({
|
|
131
|
+
name: 'My Test',
|
|
132
|
+
setup: {
|
|
133
|
+
server: {
|
|
134
|
+
rcon: {
|
|
135
|
+
host: process.env.RCON_HOST,
|
|
136
|
+
port: parseInt(process.env.RCON_PORT),
|
|
137
|
+
password: process.env.RCON_PASSWORD
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
steps: [
|
|
142
|
+
{
|
|
143
|
+
name: 'Execute command',
|
|
144
|
+
action: 'execute_command',
|
|
145
|
+
command: 'say Hello!'
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
teardown: { stop_server: false }
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
expect(result.success).toBe(true);
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Run the test:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
pilaf test my-plugin.test.js
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## License
|
|
163
|
+
|
|
164
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pilaf/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"bin": {
|
|
6
6
|
"pilaf": "./bin/pilaf.js"
|
|
7
7
|
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/cavarest/pilaf"
|
|
11
|
+
},
|
|
8
12
|
"files": [
|
|
9
13
|
"bin/**/*",
|
|
10
14
|
"lib/*.js",
|
|
@@ -18,11 +22,11 @@
|
|
|
18
22
|
"access": "public"
|
|
19
23
|
},
|
|
20
24
|
"dependencies": {
|
|
25
|
+
"@pilaf/framework": "workspace:*",
|
|
21
26
|
"commander": "^12.0.0",
|
|
22
|
-
"jest": "^29.7.0"
|
|
23
|
-
"@pilaf/framework": "1.0.0"
|
|
27
|
+
"jest": "^29.7.0"
|
|
24
28
|
},
|
|
25
29
|
"devDependencies": {
|
|
26
30
|
"@jest/globals": "^29.7.0"
|
|
27
31
|
}
|
|
28
|
-
}
|
|
32
|
+
}
|