poku 1.3.0 → 1.4.0

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 CHANGED
@@ -6,6 +6,7 @@
6
6
  [deno-version-image]: https://img.shields.io/badge/Deno->=1.30.0-70ffaf
7
7
  [npm-image]: https://img.shields.io/npm/v/poku.svg?color=3dc1d3
8
8
  [npm-url]: https://npmjs.org/package/poku
9
+ [typescript-url]: https://github.com/microsoft/TypeScript
9
10
  [ci-url]: https://github.com/wellwelwel/poku/actions/workflows/ci.yml?query=branch%3Amain
10
11
  [ci-image]: https://img.shields.io/github/actions/workflow/status/wellwelwel/poku/ci.yml?event=push&style=flat&label=CI&branch=main
11
12
  [ql-url]: https://github.com/wellwelwel/poku/actions/workflows/codeql.yml?query=branch%3Amain
@@ -17,7 +18,7 @@
17
18
 
18
19
  <img align="right" width="128" height="128" alt="Logo" src=".github/assets/readme/poku.svg">
19
20
 
20
- A flexible and easy-to-use **Test Runner** for [Node.js][node-version-url], [Bun][bun-version-url] and [Deno][deno-version-url] that allows you to run **parallel** and **sequential** tests, plus **high isolation level per test file**.
21
+ **Poku** is your test runner pet for [**Node.js**][node-version-url], [**Bun**][bun-version-url] and [**Deno**][deno-version-url] combining **flexibility**, **parallel** and **sequential** runs, **human-friendly assertion errors** and **high isolation level**.
21
22
 
22
23
  [![Node.js Version][node-version-image]][node-version-url]
23
24
  [![Bun Version][bun-version-image]][bun-version-url]
@@ -27,6 +28,12 @@ A flexible and easy-to-use **Test Runner** for [Node.js][node-version-url], [Bun
27
28
  [![GitHub Workflow Status (with event)][ci-image]][ci-url]
28
29
  [![GitHub Workflow Status (with event)][ql-image]][ql-url]
29
30
 
31
+ Enjoying Poku? Consider giving him a star ⭐️
32
+
33
+ ---
34
+
35
+ 🐷 [**Documentation Website**](https://poku.dev)
36
+
30
37
  ---
31
38
 
32
39
  ## Why Poku?
@@ -35,23 +42,29 @@ A flexible and easy-to-use **Test Runner** for [Node.js][node-version-url], [Bun
35
42
 
36
43
  - Supports **ESM** and **CJS**
37
44
  - Designed to be highly intuitive
38
- - No need to compile **TypeScript**
45
+ - No need to compile [**TypeScript**][typescript-url] \*
39
46
  - Compatible with **Coverage** tools
40
47
  - Allows both **in-code** and **CLI** usage
41
48
  - [**Node.js**][node-version-url], [**Bun**][bun-version-url] and [**Deno**][deno-version-url] compatibility
42
49
  - Zero configurations, except you want
43
50
  - No constraints or rules, code in your own signature style
51
+ - [**And much more!**](https://poku.dev)
44
52
 
45
53
  ---
46
54
 
47
55
  - <img src="https://img.shields.io/bundlephobia/min/poku?label=Final%20Size">
48
56
  - **Zero** external dependencies
49
- - **Poku** dive to the deepest depths to find tests in the specified directories
50
- - **Compatibility:** **Poku** is tested across all **Node 6+**, **Bun 0.5.3+** and **Deno 1.30+** versions
51
- - **Poku** uses itself to test its own tests using `process.exit` at several depths on the same process node
52
57
 
53
58
  ---
54
59
 
60
+ ## Documentation
61
+
62
+ - See detailed specifications and usage in [**Documentation**](https://poku.dev/docs/category/documentation) section for queries, advanced concepts and much more.
63
+
64
+ ---
65
+
66
+ ## Overview
67
+
55
68
  | Sequential | Parallel |
56
69
  | ------------------------------------------------------------ | ---------------------------------------------------------- |
57
70
  | `npx poku test/unit,test/integration` | `npx poku --parallel test/unit,test/integration` |
@@ -120,7 +133,7 @@ import { poku } from 'npm:poku';
120
133
 
121
134
  ---
122
135
 
123
- ## Basic Usage
136
+ ## Quick Start
124
137
 
125
138
  ### In-code
126
139
 
@@ -164,362 +177,7 @@ deno run npm:poku targetDirA,targetDirB
164
177
 
165
178
  ---
166
179
 
167
- ## Documentation
168
-
169
- > Website in Progress 🧑🏻‍🔧
170
- >
171
- > Initially, the documentation is based on **Node.js** usage, but you can use all the options normally for both **Bun** and **Deno**.
172
-
173
- ### `poku(targetDirs: string | string[])`
174
-
175
- #### Include directories
176
-
177
- - **in-code**
178
-
179
- ```ts
180
- poku('targetDir');
181
- ```
182
-
183
- ```ts
184
- poku(['targetDirA', 'targetDirB']);
185
- ```
186
-
187
- - **CLI**
188
-
189
- By setting the directories as the last argument:
190
-
191
- > _Since **1.3.0**_
192
-
193
- ```bash
194
- npx poku targetDir
195
- ```
196
-
197
- ```bash
198
- npx poku targetDirA,targetDirB
199
- ```
200
-
201
- By using `--include` option:
202
-
203
- > _Since **1.0.0**_
204
-
205
- ```bash
206
- npx poku --include='targetDir'
207
- ```
208
-
209
- ```bash
210
- npx poku --include='targetDirA,targetDirB'
211
- ```
212
-
213
- ---
214
-
215
- ### `poku(targetDirs: string | string[], configs?: Configs)`
216
-
217
- #### `parallel: boolean`
218
-
219
- Determines the mode of test execution across **sequential** or **parallel** modes.
220
-
221
- - **in-code**
222
-
223
- ```ts
224
- /**
225
- * @default
226
- *
227
- * Sequential mode
228
- */
229
-
230
- poku(['...'], {
231
- parallel: false,
232
- });
233
- ```
234
-
235
- ```ts
236
- /**
237
- * Parallel mode
238
- */
239
-
240
- poku(['...'], {
241
- parallel: true,
242
- });
243
- ```
244
-
245
- - **CLI**
246
-
247
- > _Since **1.2.0**_
248
-
249
- ```bash
250
- # Parallel mode
251
-
252
- npx poku --parallel ./test
253
- ```
254
-
255
- ---
256
-
257
- #### `platform: "node" | "bun" | "deno"`
258
-
259
- > _Since **1.2.0**_
260
-
261
- By default, **Poku** tries to identify the platform automatically, but you can set it manually:
262
-
263
- - **in-code**
264
-
265
- ```ts
266
- /**
267
- * Force Node.js (or tsx for TypeScript)
268
- *
269
- * @default 'node'
270
- */
271
-
272
- poku('...', {
273
- platform: 'node',
274
- });
275
- ```
276
-
277
- ```ts
278
- /**
279
- * Force Bun
280
- */
281
-
282
- poku('...', {
283
- platform: 'bun',
284
- });
285
- ```
286
-
287
- ```ts
288
- /**
289
- * Force Deno
290
- */
291
-
292
- poku('...', {
293
- platform: 'deno',
294
- });
295
- ```
296
-
297
- - **CLI**
298
-
299
- ```bash
300
- # Normal
301
-
302
- npx poku --platform=node ./test
303
- bun poku --platform=bun ./test
304
- deno run npm:poku --platform=deno ./test
305
- ```
306
-
307
- ```bash
308
- # Custom
309
- # When you're developing using a platform, but maintain compatibility with others
310
-
311
- npx poku --platform=bun ./test
312
- bun poku --platform=deno ./test
313
- deno run npm:poku --platform=node ./test
314
-
315
- # ...
316
- ```
317
-
318
- ---
319
-
320
- #### `filter: RegExp`
321
-
322
- By default, **Poku** searches for _`.test.`_ files, but you can customize it using the `filter` option.
323
-
324
- > Filter by path using **Regex** to match only the files that should be performed.
325
-
326
- - **in-code**
327
-
328
- ```ts
329
- /**
330
- * @default
331
- *
332
- * Testing all `*.test.*` files.
333
- */
334
-
335
- poku(['...'], {
336
- filter: /\.test\./,
337
- });
338
- ```
339
-
340
- ```ts
341
- /**
342
- * Testing all `ts`, `js`, `mts` and `mjs` files
343
- */
344
-
345
- poku(['...'], {
346
- filter: /\.(m)?(j|t)s$/,
347
- // filter: /\.(js|ts|mjs|mts)$/,
348
- });
349
- ```
350
-
351
- - **CLI**
352
-
353
- ```bash
354
- # Testing only a specific file
355
-
356
- npx poku --filter='some-file' ./test
357
- ```
358
-
359
- ```bash
360
- # Testing only a specific file
361
-
362
- npx poku --filter='some-file|other-file' ./test
363
- ```
364
-
365
- ```bash
366
- # Testing only paths that contains "unit"
367
-
368
- npx poku --filter='unit' ./test
369
- ```
370
-
371
- - **Environment Variable**
372
-
373
- > By using `FILTER` from **Environment Variable**, it will overwrite the `filter` option.
374
-
375
- ```bash
376
- # Testing only a specific file
377
-
378
- FILTER='some-file' npx poku ./test
379
- ```
380
-
381
- ```bash
382
- # Testing only a specific file
383
-
384
- FILTER='some-file|other-file' npx poku ./test
385
- ```
386
-
387
- ```bash
388
- # Testing only paths that contains "unit"
389
-
390
- FILTER='unit' npx poku ./test
391
- ```
392
-
393
- ---
394
-
395
- #### `exclude: RegExp | RegExp[]`
396
-
397
- > Exclude by path using Regex to match only the files that should be performed.
398
- >
399
- > _Since **1.2.0**_
400
-
401
- - **in-code**:
402
-
403
- ```ts
404
- /**
405
- * Excluding directories from tests
406
- */
407
-
408
- poku(['...'], {
409
- exclude: /\/(helpers|tools)\//,
410
- });
411
- ```
412
-
413
- ```ts
414
- /**
415
- * Excluding directories from tests
416
- */
417
-
418
- poku(['...'], {
419
- exclude: [/\/helpers\//, /\/tools\//],
420
- });
421
- ```
422
-
423
- ```ts
424
- /**
425
- * Excluding specific files from tests
426
- */
427
-
428
- poku(['...'], {
429
- exclude: /(index|common).test.ts/,
430
- });
431
- ```
432
-
433
- ```ts
434
- /**
435
- * Excluding specific files from tests
436
- */
437
-
438
- poku(['...'], {
439
- exclude: [/index.test.ts/, /common.test.ts/],
440
- });
441
- ```
442
-
443
- ```ts
444
- /**
445
- * Excluding directories and files from tests
446
- */
447
-
448
- poku(['...'], {
449
- exclude: /\/(helpers|tools)\/|(index|common).test.ts/,
450
- });
451
- ```
452
-
453
- ```ts
454
- /**
455
- * Excluding directories and files from tests
456
- */
457
-
458
- poku(['...'], {
459
- exclude: [/\/helpers\//, /\/tools\//, /index.test.ts/, /common.test.ts/],
460
- });
461
- ```
462
-
463
- - **CLI**
464
-
465
- ```bash
466
- # Excluding directories and files from tests
467
-
468
- npx poku --exclude='some-file-or-dir' ./test
469
- ```
470
-
471
- ```bash
472
- # Excluding directories and files from tests
473
-
474
- npx poku --exclude='some-file-or-dir|other-file-or-dir' ./test
475
- ```
476
-
477
- ---
478
-
479
- ### Assert
480
-
481
- > _Since **1.3.0**_
482
- >
483
- > [**Node.js**][node-version-url], [**Bun**][bun-version-url] and [**Deno**][deno-version-url] compatible.
484
-
485
- **Poku** includes the `assert` method, keeping everything as it is, but providing human readability.
486
-
487
- **Available methods:**
488
-
489
- - `assert(value[, message])`
490
- - `assert.deepEqual(actual, expected[, message])`
491
- - `assert.deepStrictEqual(actual, expected[, message])`
492
- - `assert.doesNotMatch(string, regexp[, message])`
493
- - `assert.doesNotReject(asyncFn[, error][, message])`
494
- - `assert.doesNotThrow(fn[, error][, message])`
495
- - `assert.equal(actual, expected[, message])`
496
- - `assert.fail([message])`
497
- - `assert.ifError(value)`
498
- - `assert.match(string, regexp[, message])`
499
- - `assert.notDeepEqual(actual, expected[, message])`
500
- - `assert.notDeepStrictEqual(actual, expected[, message])`
501
- - `assert.notEqual(actual, expected[, message])`
502
- - `assert.notStrictEqual(actual, expected[, message])`
503
- - `assert.ok(value[, message])`
504
- - `assert.rejects(asyncFn[, error][, message])`
505
- - `assert.strictEqual(actual, expected[, message])`
506
- - `assert.throws(fn[, error][, message])`
507
-
508
- You can follow the [**assert documentation**](https://nodejs.org/api/assert.html) from **Node.js**'s documentation.
509
-
510
- ---
511
-
512
- ### `listFiles(targetDir: string, configs?: ListFilesConfigs)`
513
-
514
- > _Since **1.2.0**_
515
-
516
- Returns all files in a directory, independent of their depth.
517
-
518
- ```ts
519
- listFiles('some-dir');
520
- ```
521
-
522
- - You can use the `filter` and `exclude` options, as well as they are for **`poku`** method.
180
+ To see the detailed documentation, please visit the [**Documentation**](https://poku.dev/docs/category/documentation) section in the [**Poku**'s website](https://poku.dev).
523
181
 
524
182
  ---
525
183
 
package/lib/bin/index.js CHANGED
@@ -11,11 +11,17 @@ const dirs = ((0, get_arg_js_1.hasArg)('include')
11
11
  : (_b = (0, get_arg_js_1.getLastParam)()) === null || _b === void 0 ? void 0 : _b.split(',')) || [];
12
12
  const platform = (0, get_arg_js_1.getArg)('platform');
13
13
  const filter = (0, get_arg_js_1.getArg)('filter');
14
- const parallel = (0, get_arg_js_1.hasArg)('parallel');
15
14
  const exclude = (0, get_arg_js_1.getArg)('exclude');
15
+ const parallel = (0, get_arg_js_1.hasArg)('parallel');
16
+ const quiet = (0, get_arg_js_1.hasArg)('quiet');
17
+ const logSuccess = (0, get_arg_js_1.hasArg)('log-success');
16
18
  (0, index_js_1.poku)(dirs, {
17
19
  platform: (0, get_runtime_js_1.platformIsValid)(platform) ? platform : undefined,
18
20
  filter: filter ? new RegExp((0, list_files_js_1.escapeRegExp)(filter)) : undefined,
19
21
  exclude: exclude ? new RegExp((0, list_files_js_1.escapeRegExp)(exclude)) : undefined,
20
22
  parallel,
23
+ quiet,
24
+ log: {
25
+ success: logSuccess,
26
+ },
21
27
  });
@@ -1,6 +1,6 @@
1
1
  import { Code } from '../@types/code.js';
2
2
  import { Configs } from '../@types/poku.js';
3
- export declare function poku(targetDirs: string | string[], configs?: Configs): Promise<void>;
4
3
  export declare function poku(targetDirs: string | string[], configs: Configs & {
5
4
  noExit: true;
6
5
  }): Promise<Code>;
6
+ export declare function poku(targetDirs: string | string[], configs?: Configs): Promise<void>;
@@ -19,9 +19,8 @@ function poku(targetDirs, configs) {
19
19
  const dirs = (0, force_array_js_1.forceArray)(targetDirs);
20
20
  if (configs === null || configs === void 0 ? void 0 : configs.parallel) {
21
21
  const results = yield Promise.all(dirs.map((dir) => (0, run_tests_js_1.runTestsParallel)(dir, configs)));
22
- if (results.some((result) => !result)) {
22
+ if (results.some((result) => !result))
23
23
  code = 1;
24
- }
25
24
  if (configs === null || configs === void 0 ? void 0 : configs.noExit)
26
25
  return code;
27
26
  (0, exit_js_1.exit)(code, configs === null || configs === void 0 ? void 0 : configs.quiet);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "poku",
3
- "version": "1.3.0",
4
- "description": "🐷 Poku is a flexible and easy-to-use Test Runner for Node.js, Bun and Deno that allows you to run parallel and sequential tests, plus high isolation level per test file",
3
+ "version": "1.4.0",
4
+ "description": "🐷 Poku is your test runner pet for Node.js, Bun and Deno, combining flexibility, parallel and sequential runs, human-friendly assertion errors and high isolation level",
5
5
  "main": "./lib/index.js",
6
6
  "scripts": {
7
7
  "test": "npx tsx --tsconfig ./tsconfig.test.json ./test/run.test.ts",
@@ -23,6 +23,7 @@
23
23
  "type": "git",
24
24
  "url": "git+https://github.com/wellwelwel/poku.git"
25
25
  },
26
+ "homepage": "https://poku.dev",
26
27
  "bin": {
27
28
  "poku": "./lib/bin/index.js"
28
29
  },
@@ -59,6 +60,7 @@
59
60
  "tap",
60
61
  "tape",
61
62
  "karma",
63
+ "urun",
62
64
  "filter",
63
65
  "exclude",
64
66
  "list",
@@ -66,7 +68,8 @@
66
68
  "list-files",
67
69
  "tsx",
68
70
  "fast",
69
- "easy"
71
+ "easy",
72
+ "poku"
70
73
  ],
71
74
  "author": "https://github.com/wellwelwel",
72
75
  "bugs": {