jest-runner-cli 0.2.0 → 0.2.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/LICENSE +21 -21
- package/README.md +353 -349
- package/README_ja.md +352 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +1 -0
- package/dist/run.js.map +1 -1
- package/package.json +63 -59
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 nojaja
|
|
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.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 nojaja
|
|
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
|
@@ -1,349 +1,353 @@
|
|
|
1
|
-
# jest-runner-cli
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
✅ **
|
|
19
|
-
✅ **
|
|
20
|
-
✅ **
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
cli.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
###
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
runner.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
cli.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
);
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
|
193
|
-
|
|
194
|
-
| `
|
|
195
|
-
| `
|
|
196
|
-
| `
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
├──
|
|
227
|
-
│
|
|
228
|
-
├──
|
|
229
|
-
|
|
230
|
-
├──
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
npm run
|
|
253
|
-
npm run
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
- **
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
-
|
|
284
|
-
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
- ✅
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
##
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
1
|
+
# jest-runner-cli
|
|
2
|
+
|
|
3
|
+
[](https://github.com/nojaja/jest-runner-cli/blob/main/README_ja.md)
|
|
4
|
+
|
|
5
|
+
**[English](./README.md)** | **[日本語](./README_ja.md)**
|
|
6
|
+
|
|
7
|
+
> A custom Jest runner with an imperative CLI process helper for testing CLI applications.
|
|
8
|
+
|
|
9
|
+
**jest-runner-cli** is a lightweight, ESM-native Jest runner package that provides:
|
|
10
|
+
- A custom Jest runner built with `create-jest-runner` for seamless integration
|
|
11
|
+
- A `CliRunner` helper class to spawn and interact with child processes in tests
|
|
12
|
+
- Full support for stdout/stderr monitoring, JSON parsing, and process management
|
|
13
|
+
|
|
14
|
+
Perfect for testing CLI tools, scripts, and command-line applications in your Jest test suite.
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
✅ **Custom Jest Runner** — Drop-in replacement for running tests with a custom runner
|
|
19
|
+
✅ **CliRunner Helper** — Easy-to-use imperative API for spawning and controlling CLI processes
|
|
20
|
+
✅ **Flexible Output Reading** — Read stdout as lines, raw text, or parse JSON
|
|
21
|
+
✅ **Auto-Exit Protection** — Automatically detect and terminate hung processes
|
|
22
|
+
✅ **Cross-Platform** — Works on Windows, macOS, and Linux
|
|
23
|
+
✅ **ESM Native** — Built with modern ESM module support
|
|
24
|
+
✅ **TypeScript Ready** — Full type definitions included
|
|
25
|
+
|
|
26
|
+
⚠️ **Limitations** — Advanced retry strategies and custom signal handling not yet implemented
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install --save-dev jest-runner-cli
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Peer Dependency:** Jest ^29.6.1
|
|
35
|
+
|
|
36
|
+
## Quick Start
|
|
37
|
+
|
|
38
|
+
### 1. Configure Jest
|
|
39
|
+
|
|
40
|
+
Update `jest.config.js`:
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
// jest.config.js (ESM)
|
|
44
|
+
export default {
|
|
45
|
+
runner: 'jest-runner-cli',
|
|
46
|
+
testMatch: ['<rootDir>/test/**/*.test.ts']
|
|
47
|
+
};
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 2. Use in Tests
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { CliRunner } from 'jest-runner-cli';
|
|
54
|
+
|
|
55
|
+
describe('CLI testing', () => {
|
|
56
|
+
it('runs node -v and captures output', async () => {
|
|
57
|
+
const cli = new CliRunner();
|
|
58
|
+
cli.start({ command: process.execPath, args: ['-v'] });
|
|
59
|
+
|
|
60
|
+
const lines = await cli.readStdout().toLines(2000);
|
|
61
|
+
expect(lines[0]).toMatch(/^v\d+\.\d+\.\d+/);
|
|
62
|
+
|
|
63
|
+
await cli.sendCtrlC();
|
|
64
|
+
cli.dispose();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Usage Guide
|
|
70
|
+
|
|
71
|
+
### Jest Runner Configuration
|
|
72
|
+
|
|
73
|
+
The package acts as a Jest custom runner. Once configured in `jest.config.js`, Jest will automatically use it to execute your test files.
|
|
74
|
+
|
|
75
|
+
### CliRunner API
|
|
76
|
+
|
|
77
|
+
#### Basic Usage
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
import { CliRunner } from 'jest-runner-cli';
|
|
81
|
+
|
|
82
|
+
const runner = new CliRunner();
|
|
83
|
+
|
|
84
|
+
// Start a process
|
|
85
|
+
runner.start({
|
|
86
|
+
command: 'node',
|
|
87
|
+
args: ['./my-script.js'],
|
|
88
|
+
cwd: process.cwd(),
|
|
89
|
+
env: process.env
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Write to stdin
|
|
93
|
+
runner.writeln('input data');
|
|
94
|
+
|
|
95
|
+
// Read output
|
|
96
|
+
const output = await runner.readStdout().toLines();
|
|
97
|
+
|
|
98
|
+
// Gracefully stop
|
|
99
|
+
await runner.sendCtrlC();
|
|
100
|
+
runner.dispose();
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
#### Reading Output
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
// Read as array of lines
|
|
107
|
+
const lines = await runner.readStdout().toLines(2000); // timeout in ms
|
|
108
|
+
|
|
109
|
+
// Read as raw string
|
|
110
|
+
const text = await runner.readStdout(2000);
|
|
111
|
+
|
|
112
|
+
// Extract JSON
|
|
113
|
+
const json = await runner.readStdout().toJson(2000);
|
|
114
|
+
|
|
115
|
+
// Get stderr
|
|
116
|
+
const errors = runner.readStderr();
|
|
117
|
+
|
|
118
|
+
// Clear buffer
|
|
119
|
+
runner.readStdout().clear();
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
#### Handling Process Events
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
// Listen for process exit
|
|
126
|
+
runner.on('exit', ({ code, signal }) => {
|
|
127
|
+
console.log(`Process exited with code ${code}`);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// Auto-exit on timeout (e.g., hung process)
|
|
131
|
+
runner.start({ command: 'node', args: ['long-running.js'] }, 5000); // 5s timeout
|
|
132
|
+
|
|
133
|
+
// Listen for auto-exit error
|
|
134
|
+
runner.once('error', (err) => {
|
|
135
|
+
if (err.message === 'auto-exit timeout reached') {
|
|
136
|
+
console.log('Process was auto-terminated');
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Complete Example
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
import { CliRunner } from 'jest-runner-cli';
|
|
145
|
+
|
|
146
|
+
describe('My CLI App', () => {
|
|
147
|
+
let cli: CliRunner;
|
|
148
|
+
|
|
149
|
+
beforeEach(() => {
|
|
150
|
+
cli = new CliRunner();
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
afterEach(async () => {
|
|
154
|
+
await cli.sendCtrlC().catch(() => {});
|
|
155
|
+
cli.dispose();
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it('displays help text', async () => {
|
|
159
|
+
cli.start({ command: 'node', args: ['./bin/cli.js', '--help'] });
|
|
160
|
+
const output = await cli.readStdout().toLines(2000);
|
|
161
|
+
|
|
162
|
+
expect(output.join('\n')).toContain('Usage:');
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it('handles JSON output', async () => {
|
|
166
|
+
cli.start({ command: 'node', args: ['./bin/cli.js', '--json'] });
|
|
167
|
+
const data = await cli.readStdout().toJson(2000);
|
|
168
|
+
|
|
169
|
+
expect(data).toHaveProperty('version');
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it('detects hung process', async () => {
|
|
173
|
+
const error = await new Promise((resolve) => {
|
|
174
|
+
cli.once('error', resolve);
|
|
175
|
+
cli.start(
|
|
176
|
+
{ command: 'node', args: ['-e', 'setTimeout(() => {}, 60000)'] },
|
|
177
|
+
3000 // 3s timeout
|
|
178
|
+
);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
expect(error.message).toBe('auto-exit timeout reached');
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## API Reference
|
|
187
|
+
|
|
188
|
+
### CliRunner
|
|
189
|
+
|
|
190
|
+
#### Methods
|
|
191
|
+
|
|
192
|
+
| Method | Parameters | Returns | Description |
|
|
193
|
+
|--------|-----------|---------|-------------|
|
|
194
|
+
| `start()` | `SpawnOptions`, `exitWaitTimeout?` | `this` | Spawn a child process. If `exitWaitTimeout` is set (ms), the process will auto-terminate if it doesn't exit within that time. |
|
|
195
|
+
| `write()` | `data: string` | `void` | Write to stdin without a newline. |
|
|
196
|
+
| `writeln()` | `data: string` | `void` | Write to stdin with a newline appended. |
|
|
197
|
+
| `readStdout()` | `timeout?: number` | `Promise<string>` \| `OutputHelper` | Read stdout buffer. With timeout arg, returns raw string. Without arg, returns helper with `.toLines()`, `.toJson()`, `.clear()` methods. |
|
|
198
|
+
| `readStderr()` | — | `string` | Get stderr buffer (non-blocking). |
|
|
199
|
+
| `sendCtrlC()` | `timeout?: number` | `Promise<void>` | Send SIGINT and wait for process exit. Falls back to SIGKILL on timeout. |
|
|
200
|
+
| `dispose()` | — | `void` | Force-kill process and release resources. |
|
|
201
|
+
|
|
202
|
+
#### Events
|
|
203
|
+
|
|
204
|
+
| Event | Callback Arguments | Description |
|
|
205
|
+
|-------|-------------------|-------------|
|
|
206
|
+
| `exit` | `{ code, signal }` | Process exited. |
|
|
207
|
+
| `stdout` | `chunk: string` | Data received on stdout. |
|
|
208
|
+
| `stderr` | `chunk: string` | Data received on stderr. |
|
|
209
|
+
| `error` | `err: Error` | Error occurred (e.g., auto-exit timeout). |
|
|
210
|
+
|
|
211
|
+
#### Types
|
|
212
|
+
|
|
213
|
+
```ts
|
|
214
|
+
type SpawnOptions = {
|
|
215
|
+
command?: string; // Required: command to execute
|
|
216
|
+
args?: string[]; // Command arguments
|
|
217
|
+
cwd?: string; // Working directory
|
|
218
|
+
env?: NodeJS.ProcessEnv; // Environment variables
|
|
219
|
+
};
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Project Structure
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
jest-runner-cli/
|
|
226
|
+
├── src/
|
|
227
|
+
│ ├── index.ts # Main entry point, Jest runner export
|
|
228
|
+
│ ├── run.ts # Jest runner implementation
|
|
229
|
+
│ └── CliRunner.ts # CliRunner class
|
|
230
|
+
├── test/unit/
|
|
231
|
+
│ └── cliRunner.test.ts # Unit tests
|
|
232
|
+
├── dist/ # Compiled output (generated)
|
|
233
|
+
├── jest.config.js # Jest configuration
|
|
234
|
+
├── tsconfig.json # TypeScript base config
|
|
235
|
+
├── tsconfig.build.json # TypeScript build config
|
|
236
|
+
└── package.json # Package metadata
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Development
|
|
240
|
+
|
|
241
|
+
### Setup
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
git clone https://github.com/yourusername/jest-runner-cli.git
|
|
245
|
+
cd jest-runner-cli
|
|
246
|
+
npm install
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Common Commands
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
npm run build # Compile TypeScript
|
|
253
|
+
npm run test # Run tests
|
|
254
|
+
npm run lint # Check code quality
|
|
255
|
+
npm run type-check # Check TypeScript types
|
|
256
|
+
npm run docs # Generate TypeDoc documentation
|
|
257
|
+
npm run depcruise # Analyze dependencies
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Testing
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
# Run all tests
|
|
264
|
+
npm test
|
|
265
|
+
|
|
266
|
+
# Run specific test file
|
|
267
|
+
npm test -- cliRunner.test.ts
|
|
268
|
+
|
|
269
|
+
# Run with coverage
|
|
270
|
+
npm run test:ci
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Technical Details
|
|
274
|
+
|
|
275
|
+
- **Runtime:** Node.js 18+, TypeScript 5.3+
|
|
276
|
+
- **Module Format:** ESM (ECMAScript Modules)
|
|
277
|
+
- **Jest Version:** 29.6.1+
|
|
278
|
+
- **Build:** TypeScript compiled to `dist/` folder
|
|
279
|
+
- **No Bundler:** Raw JS output, no webpack or similar
|
|
280
|
+
|
|
281
|
+
### Implementation Notes
|
|
282
|
+
|
|
283
|
+
- The Jest runner is built using `create-jest-runner` and delegates to Jest's core `runTest` function
|
|
284
|
+
- TypeScript is compiled with separate configs:
|
|
285
|
+
- `tsconfig.json` — development (no emit)
|
|
286
|
+
- `tsconfig.build.json` — build (emits to `dist/`)
|
|
287
|
+
- `CliRunner` is based on Node.js `child_process.spawn()` with event-driven stdout/stderr handling
|
|
288
|
+
- Auto-exit timeout uses `setTimeout` to detect hung processes and escalates from `SIGINT` to `SIGKILL`
|
|
289
|
+
|
|
290
|
+
## Troubleshooting
|
|
291
|
+
|
|
292
|
+
### Process Not Starting
|
|
293
|
+
|
|
294
|
+
**Error:** `No command provided`
|
|
295
|
+
|
|
296
|
+
```ts
|
|
297
|
+
// ❌ Wrong
|
|
298
|
+
runner.start({});
|
|
299
|
+
|
|
300
|
+
// ✅ Correct
|
|
301
|
+
runner.start({ command: 'node', args: ['script.js'] });
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Timeout Reading Output
|
|
305
|
+
|
|
306
|
+
**Error:** `stdout timeout`
|
|
307
|
+
|
|
308
|
+
Increase the timeout value:
|
|
309
|
+
|
|
310
|
+
```ts
|
|
311
|
+
// Default 2000ms, increase if needed
|
|
312
|
+
const output = await runner.readStdout().toLines(5000);
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Process Still Running After sendCtrlC
|
|
316
|
+
|
|
317
|
+
On Windows, the process may not respond to SIGINT. The runner will auto-escalate to force-kill after timeout:
|
|
318
|
+
|
|
319
|
+
```ts
|
|
320
|
+
// Will escalate to taskkill after 2000ms
|
|
321
|
+
await runner.sendCtrlC();
|
|
322
|
+
|
|
323
|
+
// Or specify custom timeout
|
|
324
|
+
await runner.sendCtrlC(5000);
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## Changelog
|
|
328
|
+
|
|
329
|
+
### v0.2.0 (Current)
|
|
330
|
+
|
|
331
|
+
- ✅ Refactored to ESM with `type: module`
|
|
332
|
+
- ✅ Integrated with `create-jest-runner` for Jest runner functionality
|
|
333
|
+
- ✅ Added comprehensive TypeScript type definitions
|
|
334
|
+
- ✅ Added auto-exit timeout feature for hung process detection
|
|
335
|
+
- ✅ Updated test suite with async/await patterns
|
|
336
|
+
|
|
337
|
+
### v0.1.0
|
|
338
|
+
|
|
339
|
+
- Initial release with basic `CliRunner` functionality
|
|
340
|
+
|
|
341
|
+
## License
|
|
342
|
+
|
|
343
|
+
MIT © 2026
|
|
344
|
+
|
|
345
|
+
## Contributing
|
|
346
|
+
|
|
347
|
+
Contributions are welcome! Please feel free to submit issues or pull requests.
|
|
348
|
+
|
|
349
|
+
For development, ensure:
|
|
350
|
+
- TypeScript strict mode is enabled
|
|
351
|
+
- All tests pass (`npm test`)
|
|
352
|
+
- Linting passes (`npm run lint`)
|
|
353
|
+
- New features include unit tests in `test/unit/`
|
package/README_ja.md
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
# jest-runner-cli
|
|
2
|
+
|
|
3
|
+
**[English](./README.md)** | **[日本語](./README_ja.md)**
|
|
4
|
+
|
|
5
|
+
> CLI アプリケーションをテストするためのカスタム Jest ランナーと命令型プロセスヘルパー
|
|
6
|
+
|
|
7
|
+
**jest-runner-cli** は、軽量でESM対応のJestランナーパッケージです。以下の機能を提供します:
|
|
8
|
+
|
|
9
|
+
- `create-jest-runner` で構築したカスタム Jest ランナーのシームレスな統合
|
|
10
|
+
- テストから子プロセスを直接制御できる `CliRunner` ヘルパークラス
|
|
11
|
+
- stdout/stderr 監視、JSON 解析、プロセス管理の完全サポート
|
|
12
|
+
|
|
13
|
+
CLI ツール、スクリプト、コマンドラインアプリケーションを Jest テストスイートでテストするのに最適です。
|
|
14
|
+
|
|
15
|
+
## 主な機能
|
|
16
|
+
|
|
17
|
+
✅ **カスタム Jest ランナー** — テスト実行用のカスタムランナーとして使用可能
|
|
18
|
+
✅ **CliRunner ヘルパー** — 子プロセスのスポーン・制御が簡単な命令型API
|
|
19
|
+
✅ **柔軟な出力読み取り** — stdout を行単位・テキスト・JSON として読み取り可能
|
|
20
|
+
✅ **自動終了保護** — ハングしたプロセスを自動検知・終了
|
|
21
|
+
✅ **クロスプラットフォーム** — Windows、macOS、Linux で動作
|
|
22
|
+
✅ **ESM ネイティブ** — モダンな ESM モジュールサポート
|
|
23
|
+
✅ **TypeScript 対応** — 完全な型定義を付属
|
|
24
|
+
|
|
25
|
+
⚠️ **制限事項** — 高度なリトライ戦略やカスタムシグナル処理は未実装
|
|
26
|
+
|
|
27
|
+
## インストール
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install --save-dev jest-runner-cli
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**ピア依存関係:** Jest ^29.6.1
|
|
34
|
+
|
|
35
|
+
## クイックスタート
|
|
36
|
+
|
|
37
|
+
### 1. Jest を設定
|
|
38
|
+
|
|
39
|
+
`jest.config.js` を更新します:
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
// jest.config.js (ESM)
|
|
43
|
+
export default {
|
|
44
|
+
runner: 'jest-runner-cli',
|
|
45
|
+
testMatch: ['<rootDir>/test/**/*.test.ts']
|
|
46
|
+
};
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 2. テストで使用
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { CliRunner } from 'jest-runner-cli';
|
|
53
|
+
|
|
54
|
+
describe('CLI テスト', () => {
|
|
55
|
+
it('node -v を実行して出力をキャプチャ', async () => {
|
|
56
|
+
const cli = new CliRunner();
|
|
57
|
+
cli.start({ command: process.execPath, args: ['-v'] });
|
|
58
|
+
|
|
59
|
+
const lines = await cli.readStdout().toLines(2000);
|
|
60
|
+
expect(lines[0]).toMatch(/^v\d+\.\d+\.\d+/);
|
|
61
|
+
|
|
62
|
+
await cli.sendCtrlC();
|
|
63
|
+
cli.dispose();
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 使用ガイド
|
|
69
|
+
|
|
70
|
+
### Jest ランナーの設定
|
|
71
|
+
|
|
72
|
+
このパッケージは Jest のカスタムランナーとして機能します。`jest.config.js` に設定されると、Jest がテストファイルを実行する際に自動的に使用されます。
|
|
73
|
+
|
|
74
|
+
### CliRunner API
|
|
75
|
+
|
|
76
|
+
#### 基本的な使い方
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
import { CliRunner } from 'jest-runner-cli';
|
|
80
|
+
|
|
81
|
+
const runner = new CliRunner();
|
|
82
|
+
|
|
83
|
+
// プロセスを開始
|
|
84
|
+
runner.start({
|
|
85
|
+
command: 'node',
|
|
86
|
+
args: ['./my-script.js'],
|
|
87
|
+
cwd: process.cwd(),
|
|
88
|
+
env: process.env
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// stdin に書き込み
|
|
92
|
+
runner.writeln('入力データ');
|
|
93
|
+
|
|
94
|
+
// 出力を読み取り
|
|
95
|
+
const output = await runner.readStdout().toLines();
|
|
96
|
+
|
|
97
|
+
// 正常に停止
|
|
98
|
+
await runner.sendCtrlC();
|
|
99
|
+
runner.dispose();
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### 出力の読み取り
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
// 行配列として読み取り
|
|
106
|
+
const lines = await runner.readStdout().toLines(2000); // タイムアウト (ms)
|
|
107
|
+
|
|
108
|
+
// 生のテキスト文字列として読み取り
|
|
109
|
+
const text = await runner.readStdout(2000);
|
|
110
|
+
|
|
111
|
+
// JSON を抽出
|
|
112
|
+
const json = await runner.readStdout().toJson(2000);
|
|
113
|
+
|
|
114
|
+
// stderr を取得
|
|
115
|
+
const errors = runner.readStderr();
|
|
116
|
+
|
|
117
|
+
// バッファをクリア
|
|
118
|
+
runner.readStdout().clear();
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
#### プロセスイベントの処理
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
// プロセス終了を監視
|
|
125
|
+
runner.on('exit', ({ code, signal }) => {
|
|
126
|
+
console.log(`プロセスが終了コード ${code} で終了`);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// タイムアウト時に自動終了(ハングしたプロセス等)
|
|
130
|
+
runner.start({ command: 'node', args: ['long-running.js'] }, 5000); // 5秒タイムアウト
|
|
131
|
+
|
|
132
|
+
// 自動終了エラーを監視
|
|
133
|
+
runner.once('error', (err) => {
|
|
134
|
+
if (err.message === 'auto-exit timeout reached') {
|
|
135
|
+
console.log('プロセスが自動停止されました');
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 完全な例
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
import { CliRunner } from 'jest-runner-cli';
|
|
144
|
+
|
|
145
|
+
describe('My CLI App', () => {
|
|
146
|
+
let cli: CliRunner;
|
|
147
|
+
|
|
148
|
+
beforeEach(() => {
|
|
149
|
+
cli = new CliRunner();
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
afterEach(async () => {
|
|
153
|
+
await cli.sendCtrlC().catch(() => {});
|
|
154
|
+
cli.dispose();
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('ヘルプテキストを表示', async () => {
|
|
158
|
+
cli.start({ command: 'node', args: ['./bin/cli.js', '--help'] });
|
|
159
|
+
const output = await cli.readStdout().toLines(2000);
|
|
160
|
+
|
|
161
|
+
expect(output.join('\n')).toContain('Usage:');
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it('JSON 出力を処理', async () => {
|
|
165
|
+
cli.start({ command: 'node', args: ['./bin/cli.js', '--json'] });
|
|
166
|
+
const data = await cli.readStdout().toJson(2000);
|
|
167
|
+
|
|
168
|
+
expect(data).toHaveProperty('version');
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
it('ハングしたプロセスを検知', async () => {
|
|
172
|
+
const error = await new Promise((resolve) => {
|
|
173
|
+
cli.once('error', resolve);
|
|
174
|
+
cli.start(
|
|
175
|
+
{ command: 'node', args: ['-e', 'setTimeout(() => {}, 60000)'] },
|
|
176
|
+
3000 // 3秒タイムアウト
|
|
177
|
+
);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
expect(error.message).toBe('auto-exit timeout reached');
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## API リファレンス
|
|
186
|
+
|
|
187
|
+
### CliRunner
|
|
188
|
+
|
|
189
|
+
#### メソッド
|
|
190
|
+
|
|
191
|
+
| メソッド | パラメータ | 戻り値 | 説明 |
|
|
192
|
+
|---------|-----------|--------|------|
|
|
193
|
+
| `start()` | `SpawnOptions`, `exitWaitTimeout?` | `this` | 子プロセスをスポーンします。`exitWaitTimeout` を設定(ミリ秒)すると、その時間内にプロセスが終了しない場合は自動停止します。 |
|
|
194
|
+
| `write()` | `data: string` | `void` | 改行なしで stdin に書き込み。 |
|
|
195
|
+
| `writeln()` | `data: string` | `void` | 改行付きで stdin に書き込み。 |
|
|
196
|
+
| `readStdout()` | `timeout?: number` | `Promise<string>` \| `OutputHelper` | stdout バッファを読み取り。タイムアウト引数あり:生テキスト返却。なし:`.toLines()`、`.toJson()`、`.clear()` メソッドを持つヘルパー返却。 |
|
|
197
|
+
| `readStderr()` | — | `string` | stderr バッファを取得(ノンブロッキング)。 |
|
|
198
|
+
| `sendCtrlC()` | `timeout?: number` | `Promise<void>` | SIGINT を送信してプロセス終了を待機。タイムアウト時は SIGKILL へエスカレート。 |
|
|
199
|
+
| `dispose()` | — | `void` | プロセスを強制終了し、リソースを解放。 |
|
|
200
|
+
|
|
201
|
+
#### イベント
|
|
202
|
+
|
|
203
|
+
| イベント | コールバック引数 | 説明 |
|
|
204
|
+
|---------|-----------------|------|
|
|
205
|
+
| `exit` | `{ code, signal }` | プロセスが終了。 |
|
|
206
|
+
| `stdout` | `chunk: string` | stdout でデータを受信。 |
|
|
207
|
+
| `stderr` | `chunk: string` | stderr でデータを受信。 |
|
|
208
|
+
| `error` | `err: Error` | エラー発生(例:自動終了タイムアウト)。 |
|
|
209
|
+
|
|
210
|
+
#### 型
|
|
211
|
+
|
|
212
|
+
```ts
|
|
213
|
+
type SpawnOptions = {
|
|
214
|
+
command?: string; // 必須:実行するコマンド
|
|
215
|
+
args?: string[]; // コマンド引数
|
|
216
|
+
cwd?: string; // 作業ディレクトリ
|
|
217
|
+
env?: NodeJS.ProcessEnv; // 環境変数
|
|
218
|
+
};
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## プロジェクト構造
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
jest-runner-cli/
|
|
225
|
+
├── src/
|
|
226
|
+
│ ├── index.ts # メインエントリーポイント、Jest ランナーのエクスポート
|
|
227
|
+
│ ├── run.ts # Jest ランナーの実装
|
|
228
|
+
│ └── CliRunner.ts # CliRunner クラス
|
|
229
|
+
├── test/unit/
|
|
230
|
+
│ └── cliRunner.test.ts # ユニットテスト
|
|
231
|
+
├── dist/ # コンパイル済み出力(自動生成)
|
|
232
|
+
├── jest.config.js # Jest 設定
|
|
233
|
+
├── tsconfig.json # TypeScript ベース設定
|
|
234
|
+
├── tsconfig.build.json # TypeScript ビルド設定
|
|
235
|
+
└── package.json # パッケージメタデータ
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## 開発
|
|
239
|
+
|
|
240
|
+
### セットアップ
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
git clone https://github.com/yourusername/jest-runner-cli.git
|
|
244
|
+
cd jest-runner-cli
|
|
245
|
+
npm install
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### 一般的なコマンド
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
npm run build # TypeScript をコンパイル
|
|
252
|
+
npm run test # テストを実行
|
|
253
|
+
npm run lint # コード品質をチェック
|
|
254
|
+
npm run type-check # TypeScript の型をチェック
|
|
255
|
+
npm run docs # TypeDoc ドキュメントを生成
|
|
256
|
+
npm run depcruise # 依存関係を分析
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### テスト実行
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
# すべてのテストを実行
|
|
263
|
+
npm test
|
|
264
|
+
|
|
265
|
+
# 特定のテストファイルを実行
|
|
266
|
+
npm test -- cliRunner.test.ts
|
|
267
|
+
|
|
268
|
+
# カバレッジ付きで実行
|
|
269
|
+
npm run test:ci
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## 技術的詳細
|
|
273
|
+
|
|
274
|
+
- **ランタイム:** Node.js 18+、TypeScript 5.3+
|
|
275
|
+
- **モジュール形式:** ESM(ECMAScript Modules)
|
|
276
|
+
- **Jest バージョン:** 29.6.1+
|
|
277
|
+
- **ビルド:** TypeScript を `dist/` フォルダにコンパイル
|
|
278
|
+
- **バンドラなし:** webpack 等を使わない生の JavaScript 出力
|
|
279
|
+
|
|
280
|
+
### 実装に関する注
|
|
281
|
+
|
|
282
|
+
- Jest ランナーは `create-jest-runner` を使用して構築され、Jest のコア `runTest` 関数に委譲します
|
|
283
|
+
- TypeScript は個別の設定でコンパイルされます:
|
|
284
|
+
- `tsconfig.json` — 開発用(エミットなし)
|
|
285
|
+
- `tsconfig.build.json` — ビルド用(`dist/` にエミット)
|
|
286
|
+
- `CliRunner` は Node.js の `child_process.spawn()` をベースに、イベント駆動の stdout/stderr 処理で実装されています
|
|
287
|
+
- 自動終了タイムアウトは `setTimeout` を使用してハングしたプロセスを検知し、`SIGINT` から `SIGKILL` へエスカレートします
|
|
288
|
+
|
|
289
|
+
## トラブルシューティング
|
|
290
|
+
|
|
291
|
+
### プロセスが開始されない
|
|
292
|
+
|
|
293
|
+
**エラー:** `No command provided`
|
|
294
|
+
|
|
295
|
+
```ts
|
|
296
|
+
// ❌ 間違い
|
|
297
|
+
runner.start({});
|
|
298
|
+
|
|
299
|
+
// ✅ 正しい
|
|
300
|
+
runner.start({ command: 'node', args: ['script.js'] });
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### 出力読み取りのタイムアウト
|
|
304
|
+
|
|
305
|
+
**エラー:** `stdout timeout`
|
|
306
|
+
|
|
307
|
+
タイムアウト値を増やしてください:
|
|
308
|
+
|
|
309
|
+
```ts
|
|
310
|
+
// デフォルト 2000ms、必要に応じて増加
|
|
311
|
+
const output = await runner.readStdout().toLines(5000);
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### sendCtrlC 後もプロセスが実行中
|
|
315
|
+
|
|
316
|
+
Windows ではプロセスが SIGINT に応答しない場合があります。ランナーはタイムアウト後に自動的に強制終了にエスカレートします:
|
|
317
|
+
|
|
318
|
+
```ts
|
|
319
|
+
// 2000ms 後に taskkill へエスカレート
|
|
320
|
+
await runner.sendCtrlC();
|
|
321
|
+
|
|
322
|
+
// またはカスタムタイムアウトを指定
|
|
323
|
+
await runner.sendCtrlC(5000);
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## 変更履歴
|
|
327
|
+
|
|
328
|
+
### v0.2.0(現在)
|
|
329
|
+
|
|
330
|
+
- ✅ `type: module` を使用した ESM への再構築
|
|
331
|
+
- ✅ `create-jest-runner` を使用した Jest ランナー機能の統合
|
|
332
|
+
- ✅ 包括的な TypeScript 型定義の追加
|
|
333
|
+
- ✅ ハングしたプロセス検知のための自動終了タイムアウト機能を追加
|
|
334
|
+
- ✅ async/await パターンでのテストスイートの更新
|
|
335
|
+
|
|
336
|
+
### v0.1.0
|
|
337
|
+
|
|
338
|
+
- `CliRunner` の基本機能での初回リリース
|
|
339
|
+
|
|
340
|
+
## ライセンス
|
|
341
|
+
|
|
342
|
+
MIT © 2026
|
|
343
|
+
|
|
344
|
+
## コントリビューション
|
|
345
|
+
|
|
346
|
+
問題報告やプルリクエストを大歓迎します!
|
|
347
|
+
|
|
348
|
+
開発時は以下の項目を確認してください:
|
|
349
|
+
- TypeScript 厳密モードが有効になっていること
|
|
350
|
+
- すべてのテストが成功すること(`npm test`)
|
|
351
|
+
- リント・チェックが成功すること(`npm run lint`)
|
|
352
|
+
- 新機能には `test/unit/` にユニットテストを含めること
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAOnD,QAAA,MAAM,aAAa,KAA4B,CAAC;AAEhD,eAAe,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
2
|
import { CliRunner } from './CliRunner.js';
|
|
3
3
|
export { CliRunner };
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
const { createJestRunner } = require('create-jest-runner');
|
|
4
6
|
const runPath = new URL('./run.js', import.meta.url).pathname;
|
|
5
7
|
const JestRunnerCli = createJestRunner(runPath);
|
|
6
8
|
export default JestRunnerCli;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,CAAC;AAGrB,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAE3D,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;AAE9D,MAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAEhD,eAAe,aAAa,CAAC"}
|
package/dist/run.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AAKxC;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,GAAG,CACzB,YAAY,EAAE,MAAM,CAAC,YAAY,EACjC,aAAa,EAAE,MAAM,CAAC,aAAa,EACnC,WAAW,EAAE,eAAe,EAC5B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,oBAGjB"}
|
package/dist/run.js
CHANGED
package/dist/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAIA,kCAAkC;AAClC,OAAO,OAAO,MAAM,8BAA8B,CAAC;AAEnD;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,GAAG,CACzB,YAAiC,EACjC,aAAmC,EACnC,WAA4B,EAC5B,OAAgB,EAChB,QAAgB;IAEhB,OAAO,OAAO,CAAC,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;AAC9E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,59 +1,63 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "jest-runner-cli",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Jest custom runner for CLI workflows with a minimal CliRunner helper",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": "./dist/index.js",
|
|
9
|
-
"./run": "./dist/run.js",
|
|
10
|
-
"./CliRunner": "./dist/CliRunner.js"
|
|
11
|
-
},
|
|
12
|
-
"files": [
|
|
13
|
-
"dist",
|
|
14
|
-
"package.json",
|
|
15
|
-
"README.md",
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"test
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"url": "https://github.com/
|
|
35
|
-
},
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
"eslint-plugin
|
|
48
|
-
"eslint
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
}
|
|
59
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "jest-runner-cli",
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "Jest custom runner for CLI workflows with a minimal CliRunner helper",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/index.js",
|
|
9
|
+
"./run": "./dist/run.js",
|
|
10
|
+
"./CliRunner": "./dist/CliRunner.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"package.json",
|
|
15
|
+
"README.md",
|
|
16
|
+
"README_ja.md",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc -p tsconfig.build.json",
|
|
22
|
+
"type-check": "tsc --noEmit",
|
|
23
|
+
"test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js",
|
|
24
|
+
"test:ci": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --coverage",
|
|
25
|
+
"test:integration": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --config jest.integration.config.cjs",
|
|
26
|
+
"test:all": "npm run build && npm run test && npm run test:integration",
|
|
27
|
+
"lint": "eslint . --ext .ts",
|
|
28
|
+
"depcruise": "depcruise --config .dependency-cruiser.cjs src",
|
|
29
|
+
"docs": "typedoc --options typedoc.json"
|
|
30
|
+
},
|
|
31
|
+
"keywords": ["cli", "runner", "test", "jest"],
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/nojaja/jest-runner-cli.git"
|
|
35
|
+
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/nojaja/jest-runner-cli/issues"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://github.com/nojaja/jest-runner-cli#readme",
|
|
40
|
+
"author": "nojaja <free.riccia@gmail.com> (https://github.com/nojaja)",
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"jest": "^29.6.1"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/jest": "^29.5.2",
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
48
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
49
|
+
"dependency-cruiser": "^17.3.5",
|
|
50
|
+
"eslint": "^8.45.0",
|
|
51
|
+
"eslint-plugin-jsdoc": "^46.0.0",
|
|
52
|
+
"eslint-plugin-sonarjs": "^0.19.0",
|
|
53
|
+
"jest": "^29.6.1",
|
|
54
|
+
"ts-jest": "^29.1.0",
|
|
55
|
+
"typedoc": "^0.28.0",
|
|
56
|
+
"typedoc-plugin-markdown": "^4.8.0",
|
|
57
|
+
"typescript": "5.3.3"
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"create-jest-runner": "^1.0.0",
|
|
61
|
+
"jest-runner": "^29.6.1"
|
|
62
|
+
}
|
|
63
|
+
}
|