poku 4.3.2-canary.d5ae3f1f โ 4.3.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 +44 -66
- package/lib/bin/enforce.js +35 -51
- package/lib/bin/help.js +21 -27
- package/lib/bin/index.js +71 -212
- package/lib/bin/jsonc.js +54 -0
- package/lib/bin/watch.js +88 -150
- package/lib/modules/_shared.cjs +729 -1289
- package/lib/modules/_shared.d.cts +325 -0
- package/lib/modules/_shared.d.ts +7 -7
- package/lib/modules/_shared.js +759 -1319
- package/lib/modules/index.cjs +26 -1
- package/lib/modules/index.d.cts +254 -0
- package/lib/modules/index.js +34 -1
- package/lib/modules/plugins.cjs +40 -25
- package/lib/modules/plugins.d.cts +23 -0
- package/lib/modules/plugins.d.ts +1 -1
- package/lib/modules/plugins.js +32 -29
- package/lib/modules/run-test-in-process.cjs +56 -0
- package/lib/modules/run-test-in-process.js +65 -0
- package/package.json +5 -8
package/README.md
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
Enjoying **Poku**? Give him a star to show your support ๐
|
|
7
7
|
|
|
8
|
-
[](https://www.npmjs.com/package/poku)
|
|
9
|
+
[](https://www.npmjs.com/package/poku)
|
|
10
10
|
[](https://github.com/wellwelwel/poku/tree/main/.nycrc)<br />
|
|
11
11
|
[](https://github.com/wellwelwel/poku/actions/workflows/ci_coverage-linux.yml?query=branch%3Amain)
|
|
12
12
|
[](https://github.com/wellwelwel/poku/actions/workflows/ci_coverage-osx.yml?query=branch%3Amain)
|
|
@@ -24,17 +24,17 @@ Enjoying **Poku**? Give him a star to show your support ๐
|
|
|
24
24
|
|
|
25
25
|
๐ก **Poku** is a cross-platform test runner that brings the [**JavaScript** essence back to testing](https://poku.io/docs/philosophy#javascript-essence-for-tests-).
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
![check][] High **isolation** level per file<br />
|
|
28
|
+
![check][] **Performant** and **lightweight**<br />
|
|
29
|
+
![check][] Auto detect **ESM**, **CJS**, and **TypeScript** files<br />
|
|
30
|
+
![check][] Run the **same test suite** for [**Node.js**](https://github.com/nodejs/node), [**Bun**](https://github.com/oven-sh/bun), and [**Deno**](https://github.com/denoland/deno)<br />
|
|
31
|
+
![check][] Easily handle **servers**, **processes**, **ports**, and even **containers** โจ
|
|
32
32
|
|
|
33
33
|
---
|
|
34
34
|
|
|
35
35
|
## Quickstart
|
|
36
36
|
|
|
37
|
-
###
|
|
37
|
+
### ![check][] Install
|
|
38
38
|
|
|
39
39
|
<table>
|
|
40
40
|
<tr>
|
|
@@ -75,7 +75,7 @@ deno add npm:poku
|
|
|
75
75
|
|
|
76
76
|
---
|
|
77
77
|
|
|
78
|
-
###
|
|
78
|
+
### ![check][] Test
|
|
79
79
|
|
|
80
80
|
<table>
|
|
81
81
|
<tr>
|
|
@@ -98,7 +98,7 @@ assert(true, 'Poku will describe it ๐ท');
|
|
|
98
98
|
|
|
99
99
|
---
|
|
100
100
|
|
|
101
|
-
###
|
|
101
|
+
### ![check][] Run
|
|
102
102
|
|
|
103
103
|
<table>
|
|
104
104
|
<tr>
|
|
@@ -135,94 +135,82 @@ deno run npm:poku
|
|
|
135
135
|
|
|
136
136
|
## Features
|
|
137
137
|
|
|
138
|
-
###
|
|
138
|
+
### ![check][] Essentials
|
|
139
139
|
|
|
140
140
|
<table>
|
|
141
141
|
<tr>
|
|
142
142
|
<td width="280"><a href="https://poku.io/docs/category/-poku">poku</a></td>
|
|
143
|
-
<td width="770">๐งช Test runner
|
|
143
|
+
<td width="770">๐งช Test runner</td>
|
|
144
144
|
</tr>
|
|
145
145
|
<tr>
|
|
146
|
-
<td><a href="https://poku.io/docs/documentation/assert">assert</a></td>
|
|
147
|
-
<td
|
|
148
|
-
</tr>
|
|
149
|
-
<tr>
|
|
150
|
-
<td><a href="https://poku.io/docs/documentation/assert">strict</a></td>
|
|
151
|
-
<td>๐ฌ Strict test assertion <i>(<strong>Node.js</strong> familiar <strong>API</strong>)</i>.</td>
|
|
146
|
+
<td><a href="https://poku.io/docs/documentation/assert">assert โข strict</a></td>
|
|
147
|
+
<td>๐ฌ Test assertion <i>(<strong>Node.js</strong> familiar <strong>API</strong>)</i></td>
|
|
152
148
|
</tr>
|
|
153
149
|
</table>
|
|
154
150
|
|
|
155
|
-
###
|
|
151
|
+
### ![check][] Helpers
|
|
156
152
|
|
|
157
153
|
<table>
|
|
158
154
|
<tr>
|
|
159
155
|
<td width="250"><a href="https://poku.io/docs/documentation/helpers/test">test</a> โข <a href="https://poku.io/docs/documentation/helpers/describe">describe</a> โข <a href="https://poku.io/docs/documentation/helpers/it">it</a></td>
|
|
160
|
-
<td width="800">๐คน๐ปโโ๏ธ Organize, group, and isolate tests
|
|
156
|
+
<td width="800">๐คน๐ปโโ๏ธ Organize, group, and isolate tests</td>
|
|
161
157
|
</tr>
|
|
162
158
|
<tr>
|
|
163
159
|
<td><a href="https://poku.io/docs/documentation/helpers/env">envFile</a></td>
|
|
164
|
-
<td>โ๏ธ Process an environment file <i>(out-of-box)</i
|
|
165
|
-
</tr>
|
|
166
|
-
<tr>
|
|
167
|
-
<td><a href="https://poku.io/docs/category/-before-and-after-each">beforeEach</a> โข <a href="https://poku.io/docs/category/-before-and-after-each">afterEach</a></td>
|
|
168
|
-
<td>๐ Hooks for test setup and teardown.</td>
|
|
160
|
+
<td>โ๏ธ Process an environment file <i>(out-of-box)</i></td>
|
|
169
161
|
</tr>
|
|
170
162
|
<tr>
|
|
171
|
-
<td><a href="https://poku.io/docs/
|
|
172
|
-
<td
|
|
163
|
+
<td><a href="https://poku.io/docs/category/-before-and-after-each">beforeEach โข afterEach</a></td>
|
|
164
|
+
<td>๐ Hooks for test setup and teardown</td>
|
|
173
165
|
</tr>
|
|
174
166
|
<tr>
|
|
175
|
-
<td><a href="https://poku.io/docs/documentation/helpers/startService">startService</a></td>
|
|
176
|
-
<td>๐ Run files in background
|
|
167
|
+
<td><a href="https://poku.io/docs/documentation/helpers/startScript">startScript</a> โข <a href="https://poku.io/docs/documentation/helpers/startService">startService</a></td>
|
|
168
|
+
<td>๐ Run package.json scripts and files in background</td>
|
|
177
169
|
</tr>
|
|
178
170
|
<tr>
|
|
179
171
|
<td><a href="https://poku.io/docs/documentation/helpers/containers">docker</a></td>
|
|
180
|
-
<td>๐ณ Build, start, compose, stop, remove, and test containers
|
|
172
|
+
<td>๐ณ Build, start, compose, stop, remove, and test containers</td>
|
|
181
173
|
</tr>
|
|
182
174
|
<tr>
|
|
183
175
|
<td><a href="https://poku.io/docs/documentation/helpers/processes/kill">kill</a></td>
|
|
184
|
-
<td>๐ Terminate ports, port ranges, and PIDs
|
|
176
|
+
<td>๐ Terminate ports, port ranges, and PIDs</td>
|
|
185
177
|
</tr>
|
|
186
178
|
<tr>
|
|
187
179
|
<td><a href="https://poku.io/docs/documentation/helpers/processes/wait-for-port">waitForPort</a></td>
|
|
188
|
-
<td>๐ด Wait for specified ports to become active
|
|
180
|
+
<td>๐ด Wait for specified ports to become active</td>
|
|
189
181
|
</tr>
|
|
190
182
|
<tr>
|
|
191
183
|
<td><a href="https://poku.io/docs/documentation/helpers/processes/wait-for-expected-result">waitForExpectedResult</a></td>
|
|
192
|
-
<td>๐ฅฑ Retry until an expected result or times out
|
|
184
|
+
<td>๐ฅฑ Retry until an expected result or times out</td>
|
|
193
185
|
</tr>
|
|
194
186
|
<tr>
|
|
195
187
|
<td><a href="https://poku.io/docs/documentation/helpers/skip">skip</a></td>
|
|
196
|
-
<td>โญ๏ธ Skip tests when necessary
|
|
188
|
+
<td>โญ๏ธ Skip tests when necessary</td>
|
|
197
189
|
</tr>
|
|
198
190
|
<tr>
|
|
199
191
|
<td><a href="https://poku.io/docs/documentation/helpers/only">only</a></td>
|
|
200
|
-
<td>๐ Debug tests by enabling selective runs
|
|
201
|
-
</tr>
|
|
202
|
-
<tr>
|
|
203
|
-
<td><a href="https://poku.io/docs/documentation/helpers/processes/get-pids">getPIDs</a></td>
|
|
204
|
-
<td>๐ต๐ป Debug processes IDs using ports and port ranges.</td>
|
|
192
|
+
<td>๐ Debug tests by enabling selective runs</td>
|
|
205
193
|
</tr>
|
|
206
194
|
</table>
|
|
207
195
|
|
|
208
|
-
###
|
|
196
|
+
### ![check][] Common Options
|
|
209
197
|
|
|
210
198
|
<table>
|
|
211
199
|
<tr>
|
|
212
200
|
<td><a href="https://poku.io/docs/documentation/helpers/coverage">coverage</a></td>
|
|
213
|
-
<td>โ๏ธ Enable coverage collection using a coverage plugin
|
|
201
|
+
<td>โ๏ธ Enable coverage collection using a coverage plugin</td>
|
|
214
202
|
</tr>
|
|
215
203
|
<tr>
|
|
216
204
|
<td><a href="https://poku.io/docs/documentation/poku/config-files">config</a></td>
|
|
217
|
-
<td>โ๏ธ Customize your <b>Poku</b> options in a config file
|
|
205
|
+
<td>โ๏ธ Customize your <b>Poku</b> options in a config file</td>
|
|
218
206
|
</tr>
|
|
219
207
|
<tr>
|
|
220
208
|
<td width="280"><a href="https://poku.io/docs/documentation/poku/options/watch">watch</a></td>
|
|
221
|
-
<td width="770">๐ฟ Watch for changes and re-run related test files
|
|
209
|
+
<td width="770">๐ฟ Watch for changes and re-run related test files</td>
|
|
222
210
|
</tr>
|
|
223
211
|
<tr>
|
|
224
212
|
<td><a href="https://poku.io/docs/documentation/poku/options/debug">debug</a></td>
|
|
225
|
-
<td>๐ต๐ป Shows all logs
|
|
213
|
+
<td>๐ต๐ป Shows all logs</td>
|
|
226
214
|
</tr>
|
|
227
215
|
</table>
|
|
228
216
|
|
|
@@ -232,21 +220,15 @@ deno run npm:poku
|
|
|
232
220
|
|
|
233
221
|
## Documentation and Examples
|
|
234
222
|
|
|
235
|
-
To see the detailed documentation, please visit the [**Documentation**](https://poku.io/docs/category/documentation) and [**Examples**](https://poku.io/docs/category/examples) sections in the [**Poku**'s website](https://poku.io).
|
|
236
|
-
|
|
237
|
-
---
|
|
238
|
-
|
|
239
|
-
### Tutorials
|
|
240
|
-
|
|
241
|
-
**Poku** offers _mini-lessons_ for different users needs in the [**Quick Tutorials**](https://poku.io/docs/category/quick-tutorials) section.
|
|
223
|
+
To see the detailed documentation, please visit the [**Documentation**](https://poku.io/docs/category/documentation) and [**Examples**](https://poku.io/docs/category/examples) sections in the [**Poku**'s website](https://poku.io). **Poku** also offers _mini-lessons_ for different users needs in the [**Quick Tutorials**](https://poku.io/docs/category/quick-tutorials) section.
|
|
242
224
|
|
|
243
225
|
---
|
|
244
226
|
|
|
245
227
|
### Common Issues (FAQ)
|
|
246
228
|
|
|
247
|
-
- [Avoiding conflicts in environments with multiple platforms installed](https://poku.io/docs/tutorials/cross-platform#recommendations)
|
|
248
|
-
- [Properly running asynchronous tests on the same file](https://poku.io/docs/examples/promises)
|
|
249
|
-
- [Using **Poku** without installing it on **Deno**](https://github.com/wellwelwel/poku/discussions/565)
|
|
229
|
+
- [Avoiding conflicts in environments with multiple platforms installed](https://poku.io/docs/tutorials/cross-platform#recommendations)
|
|
230
|
+
- [Properly running asynchronous tests on the same file](https://poku.io/docs/examples/promises)
|
|
231
|
+
- [Using **Poku** without installing it on **Deno**](https://github.com/wellwelwel/poku/discussions/565)
|
|
250
232
|
- Migrating:
|
|
251
233
|
- [**3.x.x** โ **4.x.x**](https://github.com/wellwelwel/poku/issues/1006)
|
|
252
234
|
- [**2.x.x** โ **3.x.x**](https://github.com/wellwelwel/poku/issues/801)
|
|
@@ -271,11 +253,11 @@ To see the detailed documentation, please visit the [**Documentation**](https://
|
|
|
271
253
|
|
|
272
254
|
[](https://pkg-size.dev/poku)
|
|
273
255
|
|
|
274
|
-
- [~**
|
|
275
|
-
- [~**
|
|
276
|
-
- [~**
|
|
277
|
-
- [~**
|
|
278
|
-
- [~**2.
|
|
256
|
+
- [~**145x** lighter than **Jest**](https://pkg-size.dev/jest@30.4.2)
|
|
257
|
+
- [~**124x** lighter than **Vitest**](https://pkg-size.dev/vitest@4.1.6)
|
|
258
|
+
- [~**83x** lighter than **AVA**](https://pkg-size.dev/ava@8.0.0)
|
|
259
|
+
- [~**47x** lighter than **Mocha**](https://pkg-size.dev/mocha@11.7.5)
|
|
260
|
+
- [~**2.8x** lighter than **uvu**](https://pkg-size.dev/uvu@0.5.6)
|
|
279
261
|
|
|
280
262
|
> **Poku** size ensures _cost-saving_ **CI** for services that charge for storage and usage.
|
|
281
263
|
|
|
@@ -283,8 +265,6 @@ To see the detailed documentation, please visit the [**Documentation**](https://
|
|
|
283
265
|
|
|
284
266
|
## Security Policy
|
|
285
267
|
|
|
286
|
-
[](https://github.com/wellwelwel/poku/actions/workflows/ci_codeql.yml?query=branch%3Amain)
|
|
287
|
-
|
|
288
268
|
Please check the [**SECURITY.md**](https://github.com/wellwelwel/poku/blob/main/SECURITY.md).
|
|
289
269
|
|
|
290
270
|
---
|
|
@@ -301,7 +281,7 @@ See the [**Contributing Guide**](https://github.com/wellwelwel/poku/blob/main/CO
|
|
|
301
281
|
|
|
302
282
|
My thanks to everyone who has dedicated their time and effort to improving **Poku**.
|
|
303
283
|
|
|
304
|
-
[](
|
|
284
|
+
[]()
|
|
305
285
|
|
|
306
286
|
### Sponsors
|
|
307
287
|
|
|
@@ -316,8 +296,6 @@ Really thanks to everyone who has supported and keeps supporting my work.
|
|
|
316
296
|
## License
|
|
317
297
|
|
|
318
298
|
**Poku** is under the [**MIT License**](https://github.com/wellwelwel/poku/blob/main/LICENSE).<br />
|
|
319
|
-
Copyright ยฉ 2024-present [**Weslley Araรบjo**](https://github.com/wellwelwel) and
|
|
299
|
+
Copyright ยฉ 2024-present [**Weslley Araรบjo**](https://github.com/wellwelwel) and [**contributors**](https://github.com/wellwelwel/poku/graphs/contributors).
|
|
320
300
|
|
|
321
|
-
[
|
|
322
|
-
[bun-version-url]: https://github.com/oven-sh/bun
|
|
323
|
-
[deno-version-url]: https://github.com/denoland/deno
|
|
301
|
+
[check]: https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg
|
package/lib/bin/enforce.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import {stat}from
|
|
2
|
-
|
|
1
|
+
import { stat } from "node:fs/promises";
|
|
2
|
+
import { exit, argv } from "node:process";
|
|
3
|
+
import { hr, log$1 as log, format, GLOBAL, getArg, reporter, hasArg } from "../modules/_shared.js";
|
|
4
|
+
import "node:path";
|
|
5
|
+
import "node:os";
|
|
6
|
+
import "node:child_process";
|
|
7
|
+
import "node:assert";
|
|
8
|
+
import "node:assert/strict";
|
|
9
|
+
import "node:net";
|
|
10
|
+
const errors = [], pathExists = async (arg, path) => {
|
|
3
11
|
try {
|
|
4
12
|
await stat(path);
|
|
5
13
|
} catch {
|
|
6
14
|
errors.push(`--${arg}: ./${path} doesn't exists.`);
|
|
7
15
|
}
|
|
8
|
-
}
|
|
9
|
-
const checkUselessValue = (arg) => {
|
|
16
|
+
}, checkUselessValue = (arg) => {
|
|
10
17
|
const prefix = arg.length === 1 ? "-" : "--";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
const checkRequiredValue = (arg) => {
|
|
18
|
+
typeof getArg(arg, prefix) < "u" && errors.push(`${prefix}${arg}: this flag shouldn't receive a value.`);
|
|
19
|
+
}, checkRequiredValue = (arg) => {
|
|
15
20
|
const prefix = arg.length === 1 ? "-" : "--";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
const checkFlags = () => {
|
|
21
|
+
hasArg(arg, prefix) && typeof getArg(arg, prefix) > "u" && errors.push(`${prefix}${arg}: this flag require a value.`);
|
|
22
|
+
}, checkFlags = () => {
|
|
20
23
|
const allowedFlags = /* @__PURE__ */ new Set([
|
|
21
24
|
"--concurrency",
|
|
22
25
|
"--config",
|
|
@@ -50,15 +53,12 @@ const checkFlags = () => {
|
|
|
50
53
|
"-t",
|
|
51
54
|
"-w",
|
|
52
55
|
"-x"
|
|
53
|
-
]);
|
|
54
|
-
const args = argv.slice(2);
|
|
56
|
+
]), args = argv.slice(2);
|
|
55
57
|
for (const arg of args) {
|
|
56
58
|
const flag = arg.split("=")[0];
|
|
57
|
-
|
|
58
|
-
errors.push(`${flag}: unrecognized flag.`);
|
|
59
|
+
!allowedFlags.has(flag) && flag.startsWith("-") && errors.push(`${flag}: unrecognized flag.`);
|
|
59
60
|
}
|
|
60
|
-
}
|
|
61
|
-
const checkValues = async () => {
|
|
61
|
+
}, checkValues = async () => {
|
|
62
62
|
for (const flag of [
|
|
63
63
|
"debug",
|
|
64
64
|
"enforce",
|
|
@@ -89,24 +89,16 @@ const checkValues = async () => {
|
|
|
89
89
|
"t"
|
|
90
90
|
])
|
|
91
91
|
checkRequiredValue(flag);
|
|
92
|
-
|
|
93
|
-
if (GLOBAL.envFile) await pathExists("envFile", GLOBAL.envFile);
|
|
94
|
-
if (getArg("concurrency") && typeof GLOBAL.configs.concurrency === "undefined")
|
|
95
|
-
errors.push("--concurrency: expects for a valid integer.");
|
|
96
|
-
if (getArg("timeout") && typeof GLOBAL.configs.timeout === "undefined")
|
|
97
|
-
errors.push("--timeout: expects for a valid integer.");
|
|
92
|
+
GLOBAL.configFile && await pathExists("config", GLOBAL.configFile), GLOBAL.envFile && await pathExists("envFile", GLOBAL.envFile), getArg("concurrency") && typeof GLOBAL.configs.concurrency > "u" && errors.push("--concurrency: expects for a valid integer."), getArg("timeout") && typeof GLOBAL.configs.timeout > "u" && errors.push("--timeout: expects for a valid integer.");
|
|
98
93
|
const isolationValue = getArg("isolation");
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
);
|
|
94
|
+
isolationValue && isolationValue !== "none" && isolationValue !== "process" && errors.push(
|
|
95
|
+
`--isolation: "${isolationValue}" is not valid. Available: none, process.`
|
|
96
|
+
);
|
|
103
97
|
const reporterValue = getArg("reporter") ?? getArg("r", "-");
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
};
|
|
109
|
-
const checkConfigFile = () => {
|
|
98
|
+
reporterValue && !(reporterValue in reporter) && errors.push(
|
|
99
|
+
`--reporter: "${reporterValue}" is not a valid reporter. Available: ${Object.keys(reporter).join(", ")}.`
|
|
100
|
+
);
|
|
101
|
+
}, checkConfigFile = () => {
|
|
110
102
|
const allowedProps = /* @__PURE__ */ new Set([
|
|
111
103
|
"$schema",
|
|
112
104
|
"include",
|
|
@@ -129,21 +121,13 @@ const checkConfigFile = () => {
|
|
|
129
121
|
"testNamePattern",
|
|
130
122
|
"testSkipPattern"
|
|
131
123
|
]);
|
|
132
|
-
for (const prop in GLOBAL.configsFromFile)
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
124
|
+
for (const prop in GLOBAL.configsFromFile)
|
|
125
|
+
allowedProps.has(prop) || errors.push(`${prop}: unrecognized property in the config file.`);
|
|
126
|
+
}, enforce = async () => {
|
|
127
|
+
checkFlags(), checkConfigFile(), await checkValues(), errors.length > 0 && (hr(), log(`${format("Ensure Enabled").bold()}
|
|
128
|
+
`), log(errors.map((flag) => format(flag).fail()).join(`
|
|
129
|
+
`)), hr(), exit(1));
|
|
130
|
+
};
|
|
131
|
+
export {
|
|
132
|
+
enforce
|
|
136
133
|
};
|
|
137
|
-
const enforce = async () => {
|
|
138
|
-
checkFlags();
|
|
139
|
-
checkConfigFile();
|
|
140
|
-
await checkValues();
|
|
141
|
-
if (errors.length > 0) {
|
|
142
|
-
hr();
|
|
143
|
-
log(`${format("Ensure Enabled").bold()}
|
|
144
|
-
`);
|
|
145
|
-
log(errors.map((flag) => format(flag).fail()).join("\n"));
|
|
146
|
-
hr();
|
|
147
|
-
exit(1);
|
|
148
|
-
}
|
|
149
|
-
};export{enforce};
|
package/lib/bin/help.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {hr,log$1 as log,format}from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { hr, log$1 as log, format } from "../modules/_shared.js";
|
|
2
|
+
import "node:path";
|
|
3
|
+
import "node:process";
|
|
4
|
+
import "node:os";
|
|
5
|
+
import "node:child_process";
|
|
6
|
+
import "node:assert";
|
|
7
|
+
import "node:assert/strict";
|
|
8
|
+
import "node:fs/promises";
|
|
9
|
+
import "node:net";
|
|
10
|
+
const b = (text) => `${format(text).bold()}`, i = (text) => `${format(text).italic()}`, u = (text) => `${format(text).underline()}`, d = (text) => `${format(text).dim()}`, options = i("[--options]"), paths = i("[paths]"), bullet = d("\u25CF"), summary = [
|
|
9
11
|
["--concurrency", "Limit the number of tests running concurrently."],
|
|
10
12
|
["--config, -c", "Specify a configuration file."],
|
|
11
13
|
["--coverage", "Enable coverage collection using a coverage plugin."],
|
|
@@ -37,10 +39,7 @@ const summary = [
|
|
|
37
39
|
["--version, -v", "Show Poku's installed version."],
|
|
38
40
|
["--watch, -w", "Watch for test events."],
|
|
39
41
|
["--watchInterval", "Set an interval for watch events."]
|
|
40
|
-
]
|
|
41
|
-
const sortedSummary = summary.sort(([a], [b2]) => a.localeCompare(b2));
|
|
42
|
-
const largeEndPad = Math.max(...summary.map(([start]) => start.length));
|
|
43
|
-
const header = `
|
|
42
|
+
], sortedSummary = summary.sort(([a], [b2]) => a.localeCompare(b2)), largeEndPad = Math.max(...summary.map(([start]) => start.length)), header = `
|
|
44
43
|
\u{1F437} ${format(" Poku \u2014 CLI Usage ").bg("brightMagenta")}
|
|
45
44
|
|
|
46
45
|
\u203A ${u(b("Usage:"))}
|
|
@@ -53,15 +52,15 @@ const header = `
|
|
|
53
52
|
${bullet} All CLI options use camel case pattern (e.g.: ${b("--failFast")}).
|
|
54
53
|
${bullet} Use ${b("=")} to set an option value (e.g.: ${b("--concurrency=4")}).
|
|
55
54
|
${bullet} If you're seeing this, ${u("feel special")} \u2728
|
|
56
|
-
|
|
57
|
-
const main = `
|
|
55
|
+
`, main = `
|
|
58
56
|
\u{1F43D} ${format(" Poku \u2014 Options ").bg("brightMagenta")}
|
|
59
57
|
|
|
60
58
|
\u203A ${u(b("Summary:"))}
|
|
61
59
|
|
|
62
60
|
${sortedSummary.map(
|
|
63
61
|
([command, description]) => `${command.padEnd(largeEndPad)} ${d(description)}`
|
|
64
|
-
).join(
|
|
62
|
+
).join(`
|
|
63
|
+
`)}
|
|
65
64
|
|
|
66
65
|
\u203A ${u(b("Notes:"))}
|
|
67
66
|
|
|
@@ -70,19 +69,14 @@ ${sortedSummary.map(
|
|
|
70
69
|
|
|
71
70
|
${bullet} Avoid conflicts for environments with multiple platforms:
|
|
72
71
|
${u("https://poku.io/docs/tutorials/cross-platform")}
|
|
73
|
-
|
|
74
|
-
const footer = `
|
|
72
|
+
`, footer = `
|
|
75
73
|
${b("Documentation:")} ${u("https://poku.io/docs")}
|
|
76
74
|
|
|
77
75
|
${bullet} ${b("Poku")} is made with ${b("love")} and ${b("care")} in every detail.
|
|
78
76
|
${bullet} Give him a ${b("star")} to show your support \u{1F31F}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
hr();
|
|
86
|
-
log(footer.trim());
|
|
87
|
-
hr();
|
|
88
|
-
};export{help};
|
|
77
|
+
`, help = () => {
|
|
78
|
+
hr(), log(header.trim()), hr(), log(main.trim()), hr(), log(footer.trim()), hr();
|
|
79
|
+
};
|
|
80
|
+
export {
|
|
81
|
+
help
|
|
82
|
+
};
|