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 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
- > A custom Jest runner with an imperative CLI process helper for testing CLI applications.
4
-
5
- **jest-runner-cli** is a lightweight, ESM-native Jest runner package that provides:
6
- - A custom Jest runner built with `create-jest-runner` for seamless integration
7
- - A `CliRunner` helper class to spawn and interact with child processes in tests
8
- - Full support for stdout/stderr monitoring, JSON parsing, and process management
9
-
10
- Perfect for testing CLI tools, scripts, and command-line applications in your Jest test suite.
11
-
12
- ## Features
13
-
14
- **Custom Jest Runner** Drop-in replacement for running tests with a custom runner
15
- ✅ **CliRunner Helper** — Easy-to-use imperative API for spawning and controlling CLI processes
16
- **Flexible Output Reading** — Read stdout as lines, raw text, or parse JSON
17
- ✅ **Auto-Exit Protection** — Automatically detect and terminate hung processes
18
- ✅ **Cross-Platform** — Works on Windows, macOS, and Linux
19
- ✅ **ESM Native** — Built with modern ESM module support
20
- ✅ **TypeScript Ready** — Full type definitions included
21
-
22
- ⚠️ **Limitations** — Advanced retry strategies and custom signal handling not yet implemented
23
-
24
- ## Installation
25
-
26
- ```bash
27
- npm install --save-dev jest-runner-cli
28
- ```
29
-
30
- **Peer Dependency:** Jest ^29.6.1
31
-
32
- ## Quick Start
33
-
34
- ### 1. Configure Jest
35
-
36
- Update `jest.config.js`:
37
-
38
- ```js
39
- // jest.config.js (ESM)
40
- export default {
41
- runner: 'jest-runner-cli',
42
- testMatch: ['<rootDir>/test/**/*.test.ts']
43
- };
44
- ```
45
-
46
- ### 2. Use in Tests
47
-
48
- ```ts
49
- import { CliRunner } from 'jest-runner-cli';
50
-
51
- describe('CLI testing', () => {
52
- it('runs node -v and captures output', async () => {
53
- const cli = new CliRunner();
54
- cli.start({ command: process.execPath, args: ['-v'] });
55
-
56
- const lines = await cli.readStdout().toLines(2000);
57
- expect(lines[0]).toMatch(/^v\d+\.\d+\.\d+/);
58
-
59
- await cli.sendCtrlC();
60
- cli.dispose();
61
- });
62
- });
63
- ```
64
-
65
- ## Usage Guide
66
-
67
- ### Jest Runner Configuration
68
-
69
- The package acts as a Jest custom runner. Once configured in `jest.config.js`, Jest will automatically use it to execute your test files.
70
-
71
- ### CliRunner API
72
-
73
- #### Basic Usage
74
-
75
- ```ts
76
- import { CliRunner } from 'jest-runner-cli';
77
-
78
- const runner = new CliRunner();
79
-
80
- // Start a process
81
- runner.start({
82
- command: 'node',
83
- args: ['./my-script.js'],
84
- cwd: process.cwd(),
85
- env: process.env
86
- });
87
-
88
- // Write to stdin
89
- runner.writeln('input data');
90
-
91
- // Read output
92
- const output = await runner.readStdout().toLines();
93
-
94
- // Gracefully stop
95
- await runner.sendCtrlC();
96
- runner.dispose();
97
- ```
98
-
99
- #### Reading Output
100
-
101
- ```ts
102
- // Read as array of lines
103
- const lines = await runner.readStdout().toLines(2000); // timeout in ms
104
-
105
- // Read as raw string
106
- const text = await runner.readStdout(2000);
107
-
108
- // Extract JSON
109
- const json = await runner.readStdout().toJson(2000);
110
-
111
- // Get stderr
112
- const errors = runner.readStderr();
113
-
114
- // Clear buffer
115
- runner.readStdout().clear();
116
- ```
117
-
118
- #### Handling Process Events
119
-
120
- ```ts
121
- // Listen for process exit
122
- runner.on('exit', ({ code, signal }) => {
123
- console.log(`Process exited with code ${code}`);
124
- });
125
-
126
- // Auto-exit on timeout (e.g., hung process)
127
- runner.start({ command: 'node', args: ['long-running.js'] }, 5000); // 5s timeout
128
-
129
- // Listen for auto-exit error
130
- runner.once('error', (err) => {
131
- if (err.message === 'auto-exit timeout reached') {
132
- console.log('Process was auto-terminated');
133
- }
134
- });
135
- ```
136
-
137
- ### Complete Example
138
-
139
- ```ts
140
- import { CliRunner } from 'jest-runner-cli';
141
-
142
- describe('My CLI App', () => {
143
- let cli: CliRunner;
144
-
145
- beforeEach(() => {
146
- cli = new CliRunner();
147
- });
148
-
149
- afterEach(async () => {
150
- await cli.sendCtrlC().catch(() => {});
151
- cli.dispose();
152
- });
153
-
154
- it('displays help text', async () => {
155
- cli.start({ command: 'node', args: ['./bin/cli.js', '--help'] });
156
- const output = await cli.readStdout().toLines(2000);
157
-
158
- expect(output.join('\n')).toContain('Usage:');
159
- });
160
-
161
- it('handles JSON output', async () => {
162
- cli.start({ command: 'node', args: ['./bin/cli.js', '--json'] });
163
- const data = await cli.readStdout().toJson(2000);
164
-
165
- expect(data).toHaveProperty('version');
166
- });
167
-
168
- it('detects hung process', async () => {
169
- const error = await new Promise((resolve) => {
170
- cli.once('error', resolve);
171
- cli.start(
172
- { command: 'node', args: ['-e', 'setTimeout(() => {}, 60000)'] },
173
- 3000 // 3s timeout
174
- );
175
- });
176
-
177
- expect(error.message).toBe('auto-exit timeout reached');
178
- });
179
- });
180
- ```
181
-
182
- ## API Reference
183
-
184
- ### CliRunner
185
-
186
- #### Methods
187
-
188
- | Method | Parameters | Returns | Description |
189
- |--------|-----------|---------|-------------|
190
- | `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. |
191
- | `write()` | `data: string` | `void` | Write to stdin without a newline. |
192
- | `writeln()` | `data: string` | `void` | Write to stdin with a newline appended. |
193
- | `readStdout()` | `timeout?: number` | `Promise<string>` \| `OutputHelper` | Read stdout buffer. With timeout arg, returns raw string. Without arg, returns helper with `.toLines()`, `.toJson()`, `.clear()` methods. |
194
- | `readStderr()` | | `string` | Get stderr buffer (non-blocking). |
195
- | `sendCtrlC()` | `timeout?: number` | `Promise<void>` | Send SIGINT and wait for process exit. Falls back to SIGKILL on timeout. |
196
- | `dispose()` | | `void` | Force-kill process and release resources. |
197
-
198
- #### Events
199
-
200
- | Event | Callback Arguments | Description |
201
- |-------|-------------------|-------------|
202
- | `exit` | `{ code, signal }` | Process exited. |
203
- | `stdout` | `chunk: string` | Data received on stdout. |
204
- | `stderr` | `chunk: string` | Data received on stderr. |
205
- | `error` | `err: Error` | Error occurred (e.g., auto-exit timeout). |
206
-
207
- #### Types
208
-
209
- ```ts
210
- type SpawnOptions = {
211
- command?: string; // Required: command to execute
212
- args?: string[]; // Command arguments
213
- cwd?: string; // Working directory
214
- env?: NodeJS.ProcessEnv; // Environment variables
215
- };
216
- ```
217
-
218
- ## Project Structure
219
-
220
- ```
221
- jest-runner-cli/
222
- ├── src/
223
- │ ├── index.ts # Main entry point, Jest runner export
224
- │ ├── run.ts # Jest runner implementation
225
- │ └── CliRunner.ts # CliRunner class
226
- ├── test/unit/
227
- └── cliRunner.test.ts # Unit tests
228
- ├── dist/ # Compiled output (generated)
229
- ├── jest.config.js # Jest configuration
230
- ├── tsconfig.json # TypeScript base config
231
- ├── tsconfig.build.json # TypeScript build config
232
- └── package.json # Package metadata
233
- ```
234
-
235
- ## Development
236
-
237
- ### Setup
238
-
239
- ```bash
240
- git clone https://github.com/yourusername/jest-runner-cli.git
241
- cd jest-runner-cli
242
- npm install
243
- ```
244
-
245
- ### Common Commands
246
-
247
- ```bash
248
- npm run build # Compile TypeScript
249
- npm run test # Run tests
250
- npm run lint # Check code quality
251
- npm run type-check # Check TypeScript types
252
- npm run docs # Generate TypeDoc documentation
253
- npm run depcruise # Analyze dependencies
254
- ```
255
-
256
- ### Testing
257
-
258
- ```bash
259
- # Run all tests
260
- npm test
261
-
262
- # Run specific test file
263
- npm test -- cliRunner.test.ts
264
-
265
- # Run with coverage
266
- npm run test:ci
267
- ```
268
-
269
- ## Technical Details
270
-
271
- - **Runtime:** Node.js 18+, TypeScript 5.3+
272
- - **Module Format:** ESM (ECMAScript Modules)
273
- - **Jest Version:** 29.6.1+
274
- - **Build:** TypeScript compiled to `dist/` folder
275
- - **No Bundler:** Raw JS output, no webpack or similar
276
-
277
- ### Implementation Notes
278
-
279
- - The Jest runner is built using `create-jest-runner` and delegates to Jest's core `runTest` function
280
- - TypeScript is compiled with separate configs:
281
- - `tsconfig.json` — development (no emit)
282
- - `tsconfig.build.json` — build (emits to `dist/`)
283
- - `CliRunner` is based on Node.js `child_process.spawn()` with event-driven stdout/stderr handling
284
- - Auto-exit timeout uses `setTimeout` to detect hung processes and escalates from `SIGINT` to `SIGKILL`
285
-
286
- ## Troubleshooting
287
-
288
- ### Process Not Starting
289
-
290
- **Error:** `No command provided`
291
-
292
- ```ts
293
- // ❌ Wrong
294
- runner.start({});
295
-
296
- // ✅ Correct
297
- runner.start({ command: 'node', args: ['script.js'] });
298
- ```
299
-
300
- ### Timeout Reading Output
301
-
302
- **Error:** `stdout timeout`
303
-
304
- Increase the timeout value:
305
-
306
- ```ts
307
- // Default 2000ms, increase if needed
308
- const output = await runner.readStdout().toLines(5000);
309
- ```
310
-
311
- ### Process Still Running After sendCtrlC
312
-
313
- On Windows, the process may not respond to SIGINT. The runner will auto-escalate to force-kill after timeout:
314
-
315
- ```ts
316
- // Will escalate to taskkill after 2000ms
317
- await runner.sendCtrlC();
318
-
319
- // Or specify custom timeout
320
- await runner.sendCtrlC(5000);
321
- ```
322
-
323
- ## Changelog
324
-
325
- ### v0.2.0 (Current)
326
-
327
- - ✅ Refactored to ESM with `type: module`
328
- - ✅ Integrated with `create-jest-runner` for Jest runner functionality
329
- - Added comprehensive TypeScript type definitions
330
- - ✅ Added auto-exit timeout feature for hung process detection
331
- - ✅ Updated test suite with async/await patterns
332
-
333
- ### v0.1.0
334
-
335
- - Initial release with basic `CliRunner` functionality
336
-
337
- ## License
338
-
339
- MIT © 2026
340
-
341
- ## Contributing
342
-
343
- Contributions are welcome! Please feel free to submit issues or pull requests.
344
-
345
- For development, ensure:
346
- - TypeScript strict mode is enabled
347
- - All tests pass (`npm test`)
348
- - Linting passes (`npm run lint`)
349
- - New features include unit tests in `test/unit/`
1
+ # jest-runner-cli
2
+
3
+ [![日本語ドキュメント](https://img.shields.io/badge/docs-日本語-blue.svg)](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
@@ -1,6 +1,6 @@
1
1
  import { CliRunner } from './CliRunner.js';
2
2
  export { CliRunner };
3
3
  export type { SpawnOptions } from './CliRunner.js';
4
- declare const JestRunnerCli: unknown;
4
+ declare const JestRunnerCli: any;
5
5
  export default JestRunnerCli;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD,QAAA,MAAM,aAAa,SAA4B,CAAC;AAEhD,eAAe,aAAa,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 createJestRunner from 'create-jest-runner';
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,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,CAAC;AAGrB,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"}
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;AAGxC;;;;;;;;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"}
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
@@ -1,3 +1,4 @@
1
+ // jest-runner �� runTest �֐��𒼐ڎ擾
1
2
  import runTest from 'jest-runner/build/runTest.js';
2
3
  /**
3
4
  * Jest runner entry point that delegates to the core runTest helper.
package/dist/run.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAGA,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"}
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.0",
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
- "LICENSE"
17
- ],
18
- "type": "module",
19
- "scripts": {
20
- "build": "tsc -p tsconfig.build.json",
21
- "type-check": "tsc --noEmit",
22
- "test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js",
23
- "test:ci": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --coverage",
24
- "lint": "eslint . --ext .ts",
25
- "depcruise": "depcruise --config .dependency-cruiser.cjs src",
26
- "docs": "typedoc --options typedoc.json"
27
- },
28
- "keywords": ["cli", "runner", "test", "jest"],
29
- "repository": {
30
- "type": "git",
31
- "url": "git+https://github.com/gutyoh/jest-runner-cli.git"
32
- },
33
- "bugs": {
34
- "url": "https://github.com/gutyoh/jest-runner-cli/issues"
35
- },
36
- "homepage": "https://github.com/gutyoh/jest-runner-cli#readme",
37
- "license": "MIT",
38
- "peerDependencies": {
39
- "jest": "^29.6.1"
40
- },
41
- "devDependencies": {
42
- "@types/jest": "^29.5.2",
43
- "@typescript-eslint/eslint-plugin": "^6.0.0",
44
- "@typescript-eslint/parser": "^6.0.0",
45
- "dependency-cruiser": "^17.3.5",
46
- "eslint": "^8.45.0",
47
- "eslint-plugin-jsdoc": "^46.0.0",
48
- "eslint-plugin-sonarjs": "^0.19.0",
49
- "jest": "^29.6.1",
50
- "ts-jest": "^29.1.0",
51
- "typedoc": "^0.28.0",
52
- "typedoc-plugin-markdown": "^4.8.0",
53
- "typescript": "5.3.3"
54
- },
55
- "dependencies": {
56
- "create-jest-runner": "^1.0.0",
57
- "jest-runner": "^29.6.1"
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
+ }