poku 1.11.0 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +17 -19
  2. package/lib/{helpers/parseAsssetion.d.ts → @types/assert.d.ts} +0 -1
  3. package/lib/@types/assert.js +4 -0
  4. package/lib/@types/background-process.js +2 -0
  5. package/lib/@types/code.js +2 -0
  6. package/lib/@types/list-files.d.ts +4 -0
  7. package/lib/@types/list-files.js +2 -0
  8. package/lib/@types/poku.d.ts +6 -0
  9. package/lib/@types/poku.js +2 -0
  10. package/lib/@types/runner.js +2 -0
  11. package/lib/bin/index.js +3 -1
  12. package/lib/configs/each.js +1 -0
  13. package/lib/configs/files.d.ts +2 -0
  14. package/lib/configs/files.js +9 -0
  15. package/lib/{helpers → configs}/indentation.js +2 -0
  16. package/lib/helpers/find-file.js +1 -1
  17. package/lib/helpers/format.js +1 -1
  18. package/lib/helpers/get-arg.js +2 -0
  19. package/lib/helpers/logs.js +1 -0
  20. package/lib/helpers/parse-assertion.d.ts +3 -0
  21. package/lib/helpers/{parseAsssetion.js → parse-assertion.js} +30 -7
  22. package/lib/modules/assert-promise.d.ts +1 -1
  23. package/lib/modules/assert-promise.js +19 -19
  24. package/lib/modules/assert.d.ts +1 -1
  25. package/lib/modules/assert.js +19 -19
  26. package/lib/modules/create-service.js +2 -1
  27. package/lib/modules/describe.js +1 -0
  28. package/lib/modules/each.js +2 -0
  29. package/lib/modules/poku.d.ts +0 -3
  30. package/lib/modules/poku.js +10 -10
  31. package/lib/modules/test.js +3 -0
  32. package/lib/polyfills/object.d.ts +10 -0
  33. package/lib/polyfills/object.js +23 -0
  34. package/lib/services/run-test-file.d.ts +0 -5
  35. package/lib/services/run-test-file.js +6 -12
  36. package/lib/services/run-tests.js +30 -16
  37. package/package.json +15 -8
  38. package/lib/{helpers → configs}/indentation.d.ts +0 -0
  39. package/lib/{helpers → polyfills}/pad.d.ts +0 -0
  40. package/lib/{helpers → polyfills}/pad.js +3 -3
package/README.md CHANGED
@@ -1,19 +1,19 @@
1
1
  [node-version-url]: https://github.com/nodejs/node
2
- [node-version-image]: https://img.shields.io/badge/Node.js->=%206.0.0-badc58
3
2
  [bun-version-url]: https://github.com/oven-sh/bun
4
- [bun-version-image]: https://img.shields.io/badge/Bun->=%200.5.3-f471b5
5
3
  [deno-version-url]: https://github.com/denoland/deno
6
- [deno-version-image]: https://img.shields.io/badge/Deno->=%201.30.0-70ffaf
7
4
  [typescript-url]: https://github.com/microsoft/TypeScript
8
- [typescript-version-image]: https://img.shields.io/badge/TypeScript->=%204.7.2-3077c6
9
- [ci-url]: https://github.com/wellwelwel/poku/actions/workflows/ci.yml?query=branch%3Amain
10
- [ci-image]: https://img.shields.io/github/actions/workflow/status/wellwelwel/poku/ci.yml?event=push&style=flat&label=CI&branch=main
11
- [ql-url]: https://github.com/wellwelwel/poku/actions/workflows/codeql.yml?query=branch%3Amain
12
- [ql-image]: https://img.shields.io/github/actions/workflow/status/wellwelwel/poku/ci-codeql.yml?event=push&style=flat&label=Code%20QL&branch=main
5
+ [ci-linux-url]: https://github.com/wellwelwel/poku/actions/workflows/ci_coverage-linux.yml?query=branch%3Amain
6
+ [ci-linux-image]: https://img.shields.io/github/actions/workflow/status/wellwelwel/poku/ci_coverage-linux.yml?event=push&style=flat&label=&branch=main&logo=ubuntu&logoColor=white
7
+ [ci-osx-url]: https://github.com/wellwelwel/poku/actions/workflows/ci_coverage-osx.yml?query=branch%3Amain
8
+ [ci-osx-image]: https://img.shields.io/github/actions/workflow/status/wellwelwel/poku/ci_coverage-osx.yml?event=push&style=flat&label=&branch=main&logo=apple&logoColor=white
9
+ [ci-windows-url]: https://github.com/wellwelwel/poku/actions/workflows/ci_coverage-windows.yml?query=branch%3Amain
10
+ [ci-windows-image]: https://img.shields.io/github/actions/workflow/status/wellwelwel/poku/ci_coverage-windows.yml?event=push&style=flat&label=&branch=main&logo=windows&logoColor=white
11
+ [ql-url]: https://github.com/wellwelwel/poku/actions/workflows/ci_codeql.yml?query=branch%3Amain
12
+ [ql-image]: https://img.shields.io/github/actions/workflow/status/wellwelwel/poku/ci_codeql.yml?event=push&style=flat&label=&branch=main&logo=github&logoColor=white
13
13
  [coverage-image]: https://img.shields.io/codecov/c/github/wellwelwel/poku?label=Coverage
14
14
  [coverage-url]: https://app.codecov.io/github/wellwelwel/poku
15
- [downloads-image]: https://img.shields.io/npm/dt/poku.svg?&color=FFC312&label=Downloads
16
- [downloads-url]: https://npmjs.org/package/poku
15
+ [downloads-image]: https://img.shields.io/npm/dt/poku.svg?&label=Downloads&logo=npm&logoColor=white&color=1e90ff
16
+ [downloads-url]: https://www.npmjs.com/package/poku
17
17
  [license-url]: https://github.com/wellwelwel/poku/blob/main/LICENSE
18
18
  [license-image]: https://img.shields.io/npm/l/poku.svg?maxAge=2592000&color=9c88ff&label=License
19
19
 
@@ -24,14 +24,12 @@
24
24
 
25
25
  **Poku** can show you _how simple testing can be_ 🌱
26
26
 
27
- [![Node.js Version][node-version-image]][node-version-url]
28
- [![Bun Version][bun-version-image]][bun-version-url]
29
- [![Deno Version][deno-version-image]][deno-version-url]
30
- [![TypeScript Version][typescript-version-image]][typescript-url]<br />
31
- [![GitHub Workflow Status (with event)][ci-image]][ci-url]
32
- [![GitHub Workflow Status (with event)][ql-image]][ql-url]
33
- [![Coverage][coverage-image]][coverage-url]
27
+ [![GitHub Workflow Status (with event)][ci-linux-image]][ci-linux-url]
28
+ [![GitHub Workflow Status (with event)][ci-osx-image]][ci-osx-url]
29
+ [![GitHub Workflow Status (with event)][ci-windows-image]][ci-windows-url]
30
+ [![GitHub Workflow Status (with event)][ql-image]][ql-url]<br />
34
31
  [![NPM Downloads][downloads-image]][downloads-url]
32
+ [![Coverage][coverage-image]][coverage-url]
35
33
  [![License][license-image]][license-url]
36
34
 
37
35
  Enjoying **Poku**? Consider giving him a star ⭐️
@@ -272,8 +270,8 @@ Please check the [**SECURITY.md**](./SECURITY.md) and the section [**Is Poku Saf
272
270
 
273
271
  ## Limitations
274
272
 
275
- - **Poku** is still a bit lonely, without an **active community** around him, but we can change it 🤝
276
- - Each file generates a sub-process during its execution. This can be reflected in projects with an extremely high volume of test files when run in parallel.
273
+ - **Poku** community is gradually building up 🤝
274
+ - Although it has no external dependencies, **Poku** is not _all-in-one_, so it doesn't have features such as _mocks_ and _spies_, where you can use your favorite packages or native solutions.
277
275
 
278
276
  ---
279
277
 
@@ -6,4 +6,3 @@ export type ParseAssertionOptions = {
6
6
  throw?: boolean;
7
7
  hideDiff?: boolean;
8
8
  };
9
- export declare const parseAssertion: (cb: () => void | Promise<void>, options: ParseAssertionOptions) => Promise<void>;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* c8 ignore start */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ /* c8 ignore stop */
@@ -1,2 +1,4 @@
1
1
  "use strict";
2
+ /* c8 ignore start */
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ /* c8 ignore stop */
@@ -1,2 +1,4 @@
1
1
  "use strict";
2
+ /* c8 ignore start */
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ /* c8 ignore stop */
@@ -12,3 +12,7 @@ export type Configs = {
12
12
  */
13
13
  exclude?: RegExp | RegExp[];
14
14
  };
15
+ export type FileResults = {
16
+ success: string[];
17
+ fail: string[];
18
+ };
@@ -1,2 +1,4 @@
1
1
  "use strict";
2
+ /* c8 ignore start */
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ /* c8 ignore stop */
@@ -56,6 +56,12 @@ export type Configs = {
56
56
  * @default false
57
57
  */
58
58
  failFast?: boolean;
59
+ /**
60
+ * Limits the number of tests running concurrently.
61
+ *
62
+ * @default 0
63
+ */
64
+ concurrency?: number;
59
65
  /**
60
66
  * You can use this option to run a **callback** or a **file** before each test file on your suite.
61
67
  *
@@ -1,2 +1,4 @@
1
1
  "use strict";
2
+ /* c8 ignore start */
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ /* c8 ignore stop */
@@ -1,2 +1,4 @@
1
1
  "use strict";
2
+ /* c8 ignore start */
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ /* c8 ignore stop */
package/lib/bin/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #! /usr/bin/env node
2
2
  "use strict";
3
+ /* c8 ignore start */
3
4
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
5
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
6
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -11,7 +12,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
12
  };
12
13
  var _a, _b;
13
14
  Object.defineProperty(exports, "__esModule", { value: true });
14
- /* c8 ignore start */
15
15
  const list_files_js_1 = require("../modules/list-files.js");
16
16
  const get_arg_js_1 = require("../helpers/get-arg.js");
17
17
  const index_js_1 = require("../index.js");
@@ -26,6 +26,7 @@ const exclude = (0, get_arg_js_1.getArg)('exclude');
26
26
  const killPort = (0, get_arg_js_1.getArg)('kill-port');
27
27
  const killRange = (0, get_arg_js_1.getArg)('kill-range');
28
28
  const killPID = (0, get_arg_js_1.getArg)('kill-pid');
29
+ const concurrency = Number((0, get_arg_js_1.getArg)('concurrency')) || undefined;
29
30
  const parallel = (0, get_arg_js_1.hasArg)('parallel');
30
31
  const quiet = (0, get_arg_js_1.hasArg)('quiet');
31
32
  const debug = (0, get_arg_js_1.hasArg)('debug');
@@ -58,6 +59,7 @@ if ((0, get_arg_js_1.hasArg)('log-success'))
58
59
  quiet,
59
60
  debug,
60
61
  failFast,
62
+ concurrency,
61
63
  });
62
64
  }))();
63
65
  /* c8 ignore stop */
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ /* c8 ignore start */
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.each = void 0;
4
5
  exports.each = {
@@ -0,0 +1,2 @@
1
+ import { FileResults } from '../@types/list-files.js';
2
+ export declare const fileResults: FileResults;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /* c8 ignore start */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.fileResults = void 0;
5
+ exports.fileResults = {
6
+ success: [],
7
+ fail: [],
8
+ };
9
+ /* c8 ignore stop */
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ /* c8 ignore start */
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.indentation = void 0;
4
5
  exports.indentation = {
5
6
  test: ' ',
6
7
  stdio: ' ',
7
8
  };
9
+ /* c8 ignore stop */
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.findFile = void 0;
4
- const node_os_1 = require("os");
5
4
  /* c8 ignore start */
5
+ const node_os_1 = require("os");
6
6
  const findFile = (error) => {
7
7
  var _a;
8
8
  const stackLines = ((_a = error.stack) === null || _a === void 0 ? void 0 : _a.split(node_os_1.EOL)) || [];
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getLargestStringLength = exports.format = exports.backgroundColor = void 0;
4
4
  /* c8 ignore start */
5
- const pad_js_1 = require("./pad.js");
5
+ const pad_js_1 = require("../polyfills/pad.js");
6
6
  exports.backgroundColor = {
7
7
  white: 7,
8
8
  black: 40,
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getLastParam = exports.hasArg = exports.getArg = void 0;
7
+ /* c8 ignore start */
7
8
  const node_process_1 = __importDefault(require("process"));
8
9
  const [, , ...args] = node_process_1.default.argv;
9
10
  const getArg = (arg) => {
@@ -20,3 +21,4 @@ const getLastParam = () => {
20
21
  return args[args.length - 1];
21
22
  };
22
23
  exports.getLastParam = getLastParam;
24
+ /* c8 ignore stop */
@@ -5,3 +5,4 @@ const isQuiet = (configs) => typeof (configs === null || configs === void 0 ? vo
5
5
  exports.isQuiet = isQuiet;
6
6
  const isDebug = (configs) => Boolean(configs === null || configs === void 0 ? void 0 : configs.debug);
7
7
  exports.isDebug = isDebug;
8
+ /* c8 ignore stop */
@@ -0,0 +1,3 @@
1
+ import { ParseAssertionOptions } from '../@types/assert.js';
2
+ export declare const parseResultType: (type?: unknown) => string;
3
+ export declare const parseAssertion: (cb: () => void | Promise<void>, options: ParseAssertionOptions) => Promise<void>;
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.parseAssertion = void 0;
15
+ exports.parseAssertion = exports.parseResultType = void 0;
16
16
  const node_process_1 = __importDefault(require("process"));
17
17
  const node_path_1 = __importDefault(require("path"));
18
18
  const node_assert_1 = __importDefault(require("assert"));
@@ -21,6 +21,31 @@ const format_js_1 = require("./format.js");
21
21
  const hr_js_1 = require("./hr.js");
22
22
  const find_file_js_1 = require("./find-file.js");
23
23
  const each_js_1 = require("../configs/each.js");
24
+ const object_js_1 = require("../polyfills/object.js");
25
+ const get_runtime_js_1 = require("./get-runtime.js");
26
+ const parseResultType = (type) => {
27
+ const recurse = (value) => {
28
+ if (typeof value === 'undefined')
29
+ return 'undefined';
30
+ if (typeof value === 'function' ||
31
+ typeof value === 'bigint' ||
32
+ value instanceof RegExp)
33
+ return String(value);
34
+ if (Array.isArray(value))
35
+ return value.map(recurse);
36
+ /* c8 ignore start */
37
+ if (value !== null && typeof value === 'object') {
38
+ if (!get_runtime_js_1.nodeVersion || get_runtime_js_1.nodeVersion >= 12)
39
+ return Object.fromEntries(Object.entries(value).map(([key, val]) => [key, recurse(val)]));
40
+ return (0, object_js_1.fromEntries)((0, object_js_1.entries)(value).map(([key, val]) => [key, recurse(val)]));
41
+ }
42
+ /* c8 ignore stop */
43
+ return value;
44
+ };
45
+ const result = recurse(type);
46
+ return typeof result === 'string' ? result : JSON.stringify(result, null, 2);
47
+ };
48
+ exports.parseResultType = parseResultType;
24
49
  const parseAssertion = (cb, options) => __awaiter(void 0, void 0, void 0, function* () {
25
50
  var _a, _b;
26
51
  const isPoku = typeof ((_a = node_process_1.default.env) === null || _a === void 0 ? void 0 : _a.FILE) === 'string' && ((_b = node_process_1.default.env) === null || _b === void 0 ? void 0 : _b.FILE.length) > 0;
@@ -69,14 +94,12 @@ const parseAssertion = (cb, options) => __awaiter(void 0, void 0, void 0, functi
69
94
  console.log(`${format_js_1.format.dim(' Code')} ${code}`);
70
95
  console.log(`${format_js_1.format.dim(' Operator')} ${operator}${node_os_1.EOL}`);
71
96
  if (!(options === null || options === void 0 ? void 0 : options.hideDiff)) {
97
+ const splitActual = (0, exports.parseResultType)(actual).split('\n');
98
+ const splitExpected = (0, exports.parseResultType)(expected).split('\n');
72
99
  console.log(format_js_1.format.dim(` ${(options === null || options === void 0 ? void 0 : options.actual) || 'Actual'}:`));
73
- console.log(format_js_1.format.bold(typeof actual === 'function' || actual instanceof RegExp
74
- ? ` ${String(actual)}`
75
- : ` ${format_js_1.format.fail(JSON.stringify(actual))}`));
100
+ splitActual.forEach((line) => console.log(` ${format_js_1.format.bold(format_js_1.format.fail(line))}`));
76
101
  console.log(`${node_os_1.EOL} ${format_js_1.format.dim(`${(options === null || options === void 0 ? void 0 : options.expected) || 'Expected'}:`)}`);
77
- console.log(format_js_1.format.bold(`${typeof expected === 'function' || expected instanceof RegExp
78
- ? ` ${String(expected)}`
79
- : ` ${format_js_1.format.success(JSON.stringify(expected))}`}`));
102
+ splitExpected.forEach((line) => console.log(` ${format_js_1.format.bold(format_js_1.format.success(line))}`));
80
103
  }
81
104
  if (options.throw) {
82
105
  console.log(error);
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import * as nodeAssert from 'node:assert';
3
- import { ParseAssertionOptions } from '../helpers/parseAsssetion.js';
3
+ import { ParseAssertionOptions } from '../@types/assert.js';
4
4
  declare function doesNotThrow(block: () => unknown, message?: string | ParseAssertionOptions['message']): Promise<void>;
5
5
  declare function doesNotThrow(block: () => unknown, error: nodeAssert.AssertPredicate, message?: ParseAssertionOptions['message']): Promise<void>;
6
6
  declare function throws(block: () => unknown, message?: ParseAssertionOptions['message']): Promise<void>;
@@ -34,55 +34,55 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
35
  exports.assertPromise = void 0;
36
36
  const nodeAssert = __importStar(require("assert"));
37
- const parseAsssetion_js_1 = require("../helpers/parseAsssetion.js");
37
+ const parse_assertion_js_1 = require("../helpers/parse-assertion.js");
38
38
  const get_runtime_js_1 = require("../helpers/get-runtime.js");
39
39
  const ok = (value, message) => __awaiter(void 0, void 0, void 0, function* () {
40
- yield (0, parseAsssetion_js_1.parseAssertion)(() => {
40
+ yield (0, parse_assertion_js_1.parseAssertion)(() => {
41
41
  nodeAssert.ok(value);
42
42
  }, { message });
43
43
  });
44
44
  const equal = (actual, expected, message) => __awaiter(void 0, void 0, void 0, function* () {
45
- yield (0, parseAsssetion_js_1.parseAssertion)(() => {
45
+ yield (0, parse_assertion_js_1.parseAssertion)(() => {
46
46
  nodeAssert.equal(actual, expected);
47
47
  }, { message });
48
48
  });
49
49
  const deepEqual = (actual, expected, message) => __awaiter(void 0, void 0, void 0, function* () {
50
- yield (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.deepEqual(actual, expected), {
50
+ yield (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.deepEqual(actual, expected), {
51
51
  message,
52
52
  });
53
53
  });
54
54
  const strictEqual = (actual, expected, message) => __awaiter(void 0, void 0, void 0, function* () {
55
- yield (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.strictEqual(actual, expected), {
55
+ yield (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.strictEqual(actual, expected), {
56
56
  message,
57
57
  });
58
58
  });
59
59
  const deepStrictEqual = (actual, expected, message) => __awaiter(void 0, void 0, void 0, function* () {
60
- yield (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.deepStrictEqual(actual, expected), {
60
+ yield (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.deepStrictEqual(actual, expected), {
61
61
  message,
62
62
  });
63
63
  });
64
64
  const notEqual = (actual, expected, message) => __awaiter(void 0, void 0, void 0, function* () {
65
- yield (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.notEqual(actual, expected), {
65
+ yield (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.notEqual(actual, expected), {
66
66
  message,
67
67
  });
68
68
  });
69
69
  const notDeepEqual = (actual, expected, message) => __awaiter(void 0, void 0, void 0, function* () {
70
- yield (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.notDeepEqual(actual, expected), {
70
+ yield (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.notDeepEqual(actual, expected), {
71
71
  message,
72
72
  });
73
73
  });
74
74
  const notStrictEqual = (actual, expected, message) => __awaiter(void 0, void 0, void 0, function* () {
75
- yield (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.notStrictEqual(actual, expected), {
75
+ yield (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.notStrictEqual(actual, expected), {
76
76
  message,
77
77
  });
78
78
  });
79
79
  const notDeepStrictEqual = (actual, expected, message) => __awaiter(void 0, void 0, void 0, function* () {
80
- yield (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.notDeepStrictEqual(actual, expected), {
80
+ yield (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.notDeepStrictEqual(actual, expected), {
81
81
  message,
82
82
  });
83
83
  });
84
84
  const ifError = (value, message) => __awaiter(void 0, void 0, void 0, function* () {
85
- yield (0, parseAsssetion_js_1.parseAssertion)(() => {
85
+ yield (0, parse_assertion_js_1.parseAssertion)(() => {
86
86
  nodeAssert.ifError(value);
87
87
  }, {
88
88
  message,
@@ -92,7 +92,7 @@ const ifError = (value, message) => __awaiter(void 0, void 0, void 0, function*
92
92
  });
93
93
  });
94
94
  const fail = (message) => __awaiter(void 0, void 0, void 0, function* () {
95
- yield (0, parseAsssetion_js_1.parseAssertion)(() => {
95
+ yield (0, parse_assertion_js_1.parseAssertion)(() => {
96
96
  nodeAssert.fail(message);
97
97
  }, {
98
98
  message,
@@ -102,7 +102,7 @@ const fail = (message) => __awaiter(void 0, void 0, void 0, function* () {
102
102
  });
103
103
  function doesNotThrow(block, errorOrMessage, message) {
104
104
  return __awaiter(this, void 0, void 0, function* () {
105
- yield (0, parseAsssetion_js_1.parseAssertion)(() => {
105
+ yield (0, parse_assertion_js_1.parseAssertion)(() => {
106
106
  if (typeof errorOrMessage === 'function' ||
107
107
  errorOrMessage instanceof RegExp ||
108
108
  typeof errorOrMessage === 'object') {
@@ -125,7 +125,7 @@ function throws(block, errorOrMessage, message) {
125
125
  if (typeof errorOrMessage === 'function' ||
126
126
  errorOrMessage instanceof RegExp ||
127
127
  typeof errorOrMessage === 'object') {
128
- yield (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.throws(block, errorOrMessage), {
128
+ yield (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.throws(block, errorOrMessage), {
129
129
  message,
130
130
  defaultMessage: 'Expected function to throw',
131
131
  hideDiff: true,
@@ -133,7 +133,7 @@ function throws(block, errorOrMessage, message) {
133
133
  }
134
134
  else {
135
135
  const msg = typeof errorOrMessage !== 'undefined' ? errorOrMessage : message;
136
- yield (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.throws(block, message), {
136
+ yield (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.throws(block, message), {
137
137
  message: msg,
138
138
  defaultMessage: 'Expected function to throw',
139
139
  hideDiff: true,
@@ -143,7 +143,7 @@ function throws(block, errorOrMessage, message) {
143
143
  }
144
144
  function rejects(block, errorOrMessage, message) {
145
145
  return __awaiter(this, void 0, void 0, function* () {
146
- yield (0, parseAsssetion_js_1.parseAssertion)(() => __awaiter(this, void 0, void 0, function* () {
146
+ yield (0, parse_assertion_js_1.parseAssertion)(() => __awaiter(this, void 0, void 0, function* () {
147
147
  if (typeof errorOrMessage === 'function' ||
148
148
  errorOrMessage instanceof RegExp ||
149
149
  typeof errorOrMessage === 'object') {
@@ -163,7 +163,7 @@ function rejects(block, errorOrMessage, message) {
163
163
  }
164
164
  function doesNotReject(block, errorOrMessage, message) {
165
165
  return __awaiter(this, void 0, void 0, function* () {
166
- yield (0, parseAsssetion_js_1.parseAssertion)(() => __awaiter(this, void 0, void 0, function* () {
166
+ yield (0, parse_assertion_js_1.parseAssertion)(() => __awaiter(this, void 0, void 0, function* () {
167
167
  if (typeof errorOrMessage === 'function' ||
168
168
  errorOrMessage instanceof RegExp ||
169
169
  typeof errorOrMessage === 'object')
@@ -183,7 +183,7 @@ const match = (value, regExp, message) => __awaiter(void 0, void 0, void 0, func
183
183
  if (typeof get_runtime_js_1.nodeVersion === 'number' && get_runtime_js_1.nodeVersion < 12) {
184
184
  throw new Error('match is available from Node.js 12 or higher');
185
185
  }
186
- yield (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert === null || nodeAssert === void 0 ? void 0 : nodeAssert.match(value, regExp), {
186
+ yield (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert === null || nodeAssert === void 0 ? void 0 : nodeAssert.match(value, regExp), {
187
187
  message,
188
188
  actual: 'Value',
189
189
  expected: 'RegExp',
@@ -196,7 +196,7 @@ const doesNotMatch = (value, regExp, message) => __awaiter(void 0, void 0, void
196
196
  if (typeof get_runtime_js_1.nodeVersion === 'number' && get_runtime_js_1.nodeVersion < 12) {
197
197
  throw new Error('doesNotMatch is available from Node.js 12 or higher');
198
198
  }
199
- yield (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.doesNotMatch(value, regExp), {
199
+ yield (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.doesNotMatch(value, regExp), {
200
200
  message,
201
201
  actual: 'Value',
202
202
  expected: 'RegExp',
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import * as nodeAssert from 'node:assert';
3
- import { ParseAssertionOptions } from '../helpers/parseAsssetion.js';
3
+ import { ParseAssertionOptions } from '../@types/assert.js';
4
4
  declare function doesNotThrow(block: () => unknown, message?: string | ParseAssertionOptions['message']): void;
5
5
  declare function doesNotThrow(block: () => unknown, error: nodeAssert.AssertPredicate, message?: ParseAssertionOptions['message']): void;
6
6
  declare function throws(block: () => unknown, message?: ParseAssertionOptions['message']): void;
@@ -34,49 +34,49 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
35
  exports.assert = void 0;
36
36
  const nodeAssert = __importStar(require("assert"));
37
- const parseAsssetion_js_1 = require("../helpers/parseAsssetion.js");
37
+ const parse_assertion_js_1 = require("../helpers/parse-assertion.js");
38
38
  const get_runtime_js_1 = require("../helpers/get-runtime.js");
39
39
  const ok = (value, message) => {
40
- (0, parseAsssetion_js_1.parseAssertion)(() => {
40
+ (0, parse_assertion_js_1.parseAssertion)(() => {
41
41
  nodeAssert.ok(value);
42
42
  }, { message });
43
43
  };
44
44
  const equal = (actual, expected, message) => {
45
- (0, parseAsssetion_js_1.parseAssertion)(() => {
45
+ (0, parse_assertion_js_1.parseAssertion)(() => {
46
46
  nodeAssert.equal(actual, expected);
47
47
  }, { message });
48
48
  };
49
49
  const deepEqual = (actual, expected, message) => {
50
- (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.deepEqual(actual, expected), { message });
50
+ (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.deepEqual(actual, expected), { message });
51
51
  };
52
52
  const strictEqual = (actual, expected, message) => {
53
- (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.strictEqual(actual, expected), { message });
53
+ (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.strictEqual(actual, expected), { message });
54
54
  };
55
55
  const deepStrictEqual = (actual, expected, message) => {
56
- (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.deepStrictEqual(actual, expected), {
56
+ (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.deepStrictEqual(actual, expected), {
57
57
  message,
58
58
  });
59
59
  };
60
60
  const notEqual = (actual, expected, message) => {
61
- (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.notEqual(actual, expected), {
61
+ (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.notEqual(actual, expected), {
62
62
  message,
63
63
  });
64
64
  };
65
65
  const notDeepEqual = (actual, expected, message) => {
66
- (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.notDeepEqual(actual, expected), { message });
66
+ (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.notDeepEqual(actual, expected), { message });
67
67
  };
68
68
  const notStrictEqual = (actual, expected, message) => {
69
- (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.notStrictEqual(actual, expected), {
69
+ (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.notStrictEqual(actual, expected), {
70
70
  message,
71
71
  });
72
72
  };
73
73
  const notDeepStrictEqual = (actual, expected, message) => {
74
- (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.notDeepStrictEqual(actual, expected), {
74
+ (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.notDeepStrictEqual(actual, expected), {
75
75
  message,
76
76
  });
77
77
  };
78
78
  const ifError = (value, message) => {
79
- (0, parseAsssetion_js_1.parseAssertion)(() => {
79
+ (0, parse_assertion_js_1.parseAssertion)(() => {
80
80
  nodeAssert.ifError(value);
81
81
  }, {
82
82
  message,
@@ -86,7 +86,7 @@ const ifError = (value, message) => {
86
86
  });
87
87
  };
88
88
  const fail = (message) => {
89
- (0, parseAsssetion_js_1.parseAssertion)(() => {
89
+ (0, parse_assertion_js_1.parseAssertion)(() => {
90
90
  nodeAssert.fail(message);
91
91
  }, {
92
92
  message,
@@ -95,7 +95,7 @@ const fail = (message) => {
95
95
  });
96
96
  };
97
97
  function doesNotThrow(block, errorOrMessage, message) {
98
- (0, parseAsssetion_js_1.parseAssertion)(() => {
98
+ (0, parse_assertion_js_1.parseAssertion)(() => {
99
99
  if (typeof errorOrMessage === 'function' ||
100
100
  errorOrMessage instanceof RegExp ||
101
101
  typeof errorOrMessage === 'object') {
@@ -116,7 +116,7 @@ function throws(block, errorOrMessage, message) {
116
116
  if (typeof errorOrMessage === 'function' ||
117
117
  errorOrMessage instanceof RegExp ||
118
118
  typeof errorOrMessage === 'object') {
119
- (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.throws(block, errorOrMessage), {
119
+ (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.throws(block, errorOrMessage), {
120
120
  message,
121
121
  defaultMessage: 'Expected function to throw',
122
122
  hideDiff: true,
@@ -124,7 +124,7 @@ function throws(block, errorOrMessage, message) {
124
124
  }
125
125
  else {
126
126
  const msg = typeof errorOrMessage !== 'undefined' ? errorOrMessage : message;
127
- (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.throws(block, message), {
127
+ (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.throws(block, message), {
128
128
  message: msg,
129
129
  defaultMessage: 'Expected function to throw',
130
130
  hideDiff: true,
@@ -133,7 +133,7 @@ function throws(block, errorOrMessage, message) {
133
133
  }
134
134
  function rejects(block, errorOrMessage, message) {
135
135
  return __awaiter(this, void 0, void 0, function* () {
136
- yield (0, parseAsssetion_js_1.parseAssertion)(() => __awaiter(this, void 0, void 0, function* () {
136
+ yield (0, parse_assertion_js_1.parseAssertion)(() => __awaiter(this, void 0, void 0, function* () {
137
137
  if (typeof errorOrMessage === 'function' ||
138
138
  errorOrMessage instanceof RegExp ||
139
139
  typeof errorOrMessage === 'object') {
@@ -153,7 +153,7 @@ function rejects(block, errorOrMessage, message) {
153
153
  }
154
154
  function doesNotReject(block, errorOrMessage, message) {
155
155
  return __awaiter(this, void 0, void 0, function* () {
156
- yield (0, parseAsssetion_js_1.parseAssertion)(() => __awaiter(this, void 0, void 0, function* () {
156
+ yield (0, parse_assertion_js_1.parseAssertion)(() => __awaiter(this, void 0, void 0, function* () {
157
157
  if (typeof errorOrMessage === 'function' ||
158
158
  errorOrMessage instanceof RegExp ||
159
159
  typeof errorOrMessage === 'object')
@@ -173,7 +173,7 @@ const match = (value, regExp, message) => {
173
173
  if (typeof get_runtime_js_1.nodeVersion === 'number' && get_runtime_js_1.nodeVersion < 12) {
174
174
  throw new Error('match is available from Node.js 12 or higher');
175
175
  }
176
- (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert === null || nodeAssert === void 0 ? void 0 : nodeAssert.match(value, regExp), {
176
+ (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert === null || nodeAssert === void 0 ? void 0 : nodeAssert.match(value, regExp), {
177
177
  message,
178
178
  actual: 'Value',
179
179
  expected: 'RegExp',
@@ -186,7 +186,7 @@ const doesNotMatch = (value, regExp, message) => {
186
186
  if (typeof get_runtime_js_1.nodeVersion === 'number' && get_runtime_js_1.nodeVersion < 12) {
187
187
  throw new Error('doesNotMatch is available from Node.js 12 or higher');
188
188
  }
189
- (0, parseAsssetion_js_1.parseAssertion)(() => nodeAssert.doesNotMatch(value, regExp), {
189
+ (0, parse_assertion_js_1.parseAssertion)(() => nodeAssert.doesNotMatch(value, regExp), {
190
190
  message,
191
191
  actual: 'Value',
192
192
  expected: 'RegExp',
@@ -36,7 +36,8 @@ const backgroundProcess = (runtime, args, file, options) => new Promise((resolve
36
36
  shell: runner_js_1.isWindows,
37
37
  cwd: (options === null || options === void 0 ? void 0 : options.cwd)
38
38
  ? (0, list_files_js_1.sanitizePath)(node_path_1.default.normalize(options.cwd))
39
- : undefined,
39
+ : /* c8 ignore next */
40
+ undefined,
40
41
  env: node_process_1.default.env,
41
42
  /* c8 ignore next */
42
43
  detached: !runner_js_1.isWindows,
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.describe = exports.log = void 0;
4
+ /* c8 ignore start */
4
5
  const node_os_1 = require("os");
5
6
  const format_js_1 = require("../helpers/format.js");
6
7
  /**
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.afterEach = exports.beforeEach = void 0;
4
+ /* c8 ignore next */
4
5
  const each_js_1 = require("../configs/each.js");
6
+ /* c8 ignore stop */
5
7
  /**
6
8
  * - ✅ Handling **global** and **external** services (_preparing a database, for example_)
7
9
  * - ✅ It's made for **exclusive use** in combination with **Poku**'s **`assert`** methods
@@ -1,6 +1,3 @@
1
- /**
2
- * Both CLI, API, noExit, sequential and parallel runs are strictly tested, but these tests use deep child process for it
3
- */
4
1
  import { Code } from '../@types/code.js';
5
2
  import { Configs } from '../@types/poku.js';
6
3
  export declare function poku(targetPaths: string | string[], configs: Configs & {
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
- /**
3
- * Both CLI, API, noExit, sequential and parallel runs are strictly tested, but these tests use deep child process for it
4
- */
2
+ /* c8 ignore start */
5
3
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
6
4
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7
5
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -13,7 +11,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
13
11
  };
14
12
  Object.defineProperty(exports, "__esModule", { value: true });
15
13
  exports.poku = void 0;
16
- /* c8 ignore start */
14
+ /**
15
+ * Both CLI, API, noExit, sequential and parallel runs are strictly tested, but these tests use deep child process for it
16
+ */
17
17
  const node_os_1 = require("os");
18
18
  const force_array_js_1 = require("../helpers/force-array.js");
19
19
  const run_tests_js_1 = require("../services/run-tests.js");
@@ -21,8 +21,8 @@ const exit_js_1 = require("./exit.js");
21
21
  const format_js_1 = require("../helpers/format.js");
22
22
  const logs_js_1 = require("../helpers/logs.js");
23
23
  const hr_js_1 = require("../helpers/hr.js");
24
- const run_test_file_js_1 = require("../services/run-test-file.js");
25
- const indentation_js_1 = require("../helpers/indentation.js");
24
+ const files_js_1 = require("../configs/files.js");
25
+ const indentation_js_1 = require("../configs/indentation.js");
26
26
  function poku(targetPaths, configs) {
27
27
  return __awaiter(this, void 0, void 0, function* () {
28
28
  let code = 0;
@@ -62,12 +62,12 @@ function poku(targetPaths, configs) {
62
62
  }
63
63
  catch (_a) { }
64
64
  showLogs && (0, hr_js_1.hr)();
65
- if (showLogs && run_test_file_js_1.fileResults.success.length > 0)
66
- console.log(run_test_file_js_1.fileResults.success
65
+ if (showLogs && files_js_1.fileResults.success.length > 0)
66
+ console.log(files_js_1.fileResults.success
67
67
  .map((current) => `${indentation_js_1.indentation.test}${format_js_1.format.success('✔')} ${format_js_1.format.dim(current)}`)
68
68
  .join(node_os_1.EOL));
69
- if (showLogs && run_test_file_js_1.fileResults.fail.length > 0)
70
- console.log(run_test_file_js_1.fileResults.fail
69
+ if (showLogs && files_js_1.fileResults.fail.length > 0)
70
+ console.log(files_js_1.fileResults.fail
71
71
  .map((current) => `${indentation_js_1.indentation.test}${format_js_1.format.fail('✘')} ${current}`)
72
72
  .join(node_os_1.EOL));
73
73
  if (configs === null || configs === void 0 ? void 0 : configs.noExit)
@@ -10,11 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.test = void 0;
13
+ /* c8 ignore next */
13
14
  const each_js_1 = require("../configs/each.js");
14
15
  function test(cb) {
15
16
  return __awaiter(this, void 0, void 0, function* () {
16
17
  if (typeof each_js_1.each.before.cb === 'function' && each_js_1.each.before.test) {
17
18
  const beforeResult = each_js_1.each.before.cb();
19
+ /* c8 ignore next */
18
20
  if (beforeResult instanceof Promise)
19
21
  yield beforeResult;
20
22
  }
@@ -24,6 +26,7 @@ function test(cb) {
24
26
  yield resultCb;
25
27
  if (typeof each_js_1.each.after.cb === 'function' && each_js_1.each.after.test) {
26
28
  const afterResult = each_js_1.each.after.cb();
29
+ /* c8 ignore next */
27
30
  if (afterResult instanceof Promise)
28
31
  yield afterResult;
29
32
  }
@@ -0,0 +1,10 @@
1
+ export declare const entries: (obj: {
2
+ [key: string]: any;
3
+ }) => [
4
+ string,
5
+ unknown
6
+ ][];
7
+ export declare const fromEntries: (entries: [
8
+ string,
9
+ unknown
10
+ ][]) => Record<string, unknown>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ /* c8 ignore start */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.fromEntries = exports.entries = void 0;
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ const entries = (obj) => {
7
+ const ownProps = Object.keys(obj);
8
+ let i = ownProps.length;
9
+ const resArray = new Array(i);
10
+ // benchmark `while` outperformed `for`
11
+ while (i--)
12
+ resArray[i] = [ownProps[i], obj[ownProps[i]]];
13
+ return resArray;
14
+ };
15
+ exports.entries = entries;
16
+ const fromEntries = (entries) => {
17
+ return entries.reduce((acc, [key, value]) => {
18
+ acc[key] = value;
19
+ return acc;
20
+ }, {});
21
+ };
22
+ exports.fromEntries = fromEntries;
23
+ /* c8 ignore stop */
@@ -1,7 +1,2 @@
1
1
  import { Configs } from '../@types/poku.js';
2
- export type FileResults = {
3
- success: string[];
4
- fail: string[];
5
- };
6
- export declare const fileResults: FileResults;
7
2
  export declare const runTestFile: (filePath: string, configs?: Configs) => Promise<boolean>;
@@ -12,24 +12,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.runTestFile = exports.fileResults = void 0;
15
+ exports.runTestFile = void 0;
16
16
  const node_process_1 = __importDefault(require("process"));
17
17
  const node_path_1 = __importDefault(require("path"));
18
18
  const node_os_1 = require("os");
19
19
  const node_child_process_1 = require("child_process");
20
20
  const runner_js_1 = require("../helpers/runner.js");
21
- const indentation_js_1 = require("../helpers/indentation.js");
21
+ const indentation_js_1 = require("../configs/indentation.js");
22
22
  const format_js_1 = require("../helpers/format.js");
23
23
  const logs_js_1 = require("../helpers/logs.js");
24
24
  const remove_repeats_js_1 = require("../helpers/remove-repeats.js");
25
25
  const each_js_1 = require("./each.js");
26
- /* c8 ignore stop */
27
- /* c8 ignore start */
28
- exports.fileResults = {
29
- success: [],
30
- fail: [],
31
- };
32
- /* c8 ignore stop */
26
+ const files_js_1 = require("../configs/files.js");
33
27
  const runTestFile = (filePath, configs) => new Promise((resolve) => __awaiter(void 0, void 0, void 0, function* () {
34
28
  const runtimeOptions = (0, runner_js_1.runner)(filePath, configs);
35
29
  const runtime = runtimeOptions.shift();
@@ -91,14 +85,14 @@ const runTestFile = (filePath, configs) => new Promise((resolve) => __awaiter(vo
91
85
  return false;
92
86
  const result = code === 0;
93
87
  if (result)
94
- exports.fileResults.success.push(fileRelative);
88
+ files_js_1.fileResults.success.push(fileRelative);
95
89
  else
96
- exports.fileResults.fail.push(fileRelative);
90
+ files_js_1.fileResults.fail.push(fileRelative);
97
91
  resolve(result);
98
92
  }));
99
93
  child.on('error', (err) => {
100
94
  console.log(`Failed to start test: ${filePath}`, err);
101
- exports.fileResults.fail.push(fileRelative);
95
+ files_js_1.fileResults.fail.push(fileRelative);
102
96
  resolve(false);
103
97
  });
104
98
  }));
@@ -17,16 +17,18 @@ const node_process_1 = __importDefault(require("process"));
17
17
  const node_os_1 = require("os");
18
18
  const node_path_1 = __importDefault(require("path"));
19
19
  const runner_js_1 = require("../helpers/runner.js");
20
- const indentation_js_1 = require("../helpers/indentation.js");
20
+ const indentation_js_1 = require("../configs/indentation.js");
21
21
  const list_files_js_1 = require("../modules/list-files.js");
22
22
  const hr_js_1 = require("../helpers/hr.js");
23
23
  const format_js_1 = require("../helpers/format.js");
24
24
  const run_test_file_js_1 = require("./run-test-file.js");
25
25
  const logs_js_1 = require("../helpers/logs.js");
26
+ /* c8 ignore start */
26
27
  exports.results = {
27
28
  success: 0,
28
29
  fail: 0,
29
30
  };
31
+ /* c8 ignore stop */
30
32
  const runTests = (dir, configs) => __awaiter(void 0, void 0, void 0, function* () {
31
33
  const cwd = node_process_1.default.cwd();
32
34
  const testDir = node_path_1.default.join(cwd, (0, list_files_js_1.sanitizePath)(dir));
@@ -73,22 +75,34 @@ const runTestsParallel = (dir, configs) => __awaiter(void 0, void 0, void 0, fun
73
75
  const cwd = node_process_1.default.cwd();
74
76
  const testDir = node_path_1.default.join(cwd, dir);
75
77
  const files = (0, list_files_js_1.isFile)(dir) ? [dir] : (0, list_files_js_1.listFiles)(testDir, undefined, configs);
78
+ const filesByConcurrency = [];
79
+ const concurrencyLimit = (configs === null || configs === void 0 ? void 0 : configs.concurrency) || 0;
80
+ const concurrencyResults = [];
81
+ if (concurrencyLimit > 0)
82
+ for (let i = 0; i < files.length; i += concurrencyLimit) {
83
+ filesByConcurrency.push(files.slice(i, i + concurrencyLimit));
84
+ }
85
+ else
86
+ filesByConcurrency.push(files);
76
87
  try {
77
- const promises = files.map((filePath) => __awaiter(void 0, void 0, void 0, function* () {
78
- if ((configs === null || configs === void 0 ? void 0 : configs.failFast) && exports.results.fail > 0)
79
- return;
80
- const testPassed = yield (0, run_test_file_js_1.runTestFile)(filePath, configs);
81
- if (!testPassed) {
82
- ++exports.results.fail;
83
- if (configs === null || configs === void 0 ? void 0 : configs.failFast)
84
- throw ` ${format_js_1.format.fail('ℹ')} ${format_js_1.format.bold('fail-fast')} is enabled`;
85
- return false;
86
- }
87
- ++exports.results.success;
88
- return true;
89
- }));
90
- const concurrency = yield Promise.all(promises);
91
- return concurrency.every((result) => result);
88
+ for (const fileGroup of filesByConcurrency) {
89
+ const promises = fileGroup.map((filePath) => __awaiter(void 0, void 0, void 0, function* () {
90
+ if ((configs === null || configs === void 0 ? void 0 : configs.failFast) && exports.results.fail > 0)
91
+ return;
92
+ const testPassed = yield (0, run_test_file_js_1.runTestFile)(filePath, configs);
93
+ if (!testPassed) {
94
+ ++exports.results.fail;
95
+ if (configs === null || configs === void 0 ? void 0 : configs.failFast)
96
+ throw ` ${format_js_1.format.fail('ℹ')} ${format_js_1.format.bold('fail-fast')} is enabled`;
97
+ return false;
98
+ }
99
+ ++exports.results.success;
100
+ return true;
101
+ }));
102
+ const concurrency = yield Promise.all(promises);
103
+ concurrencyResults.push(concurrency);
104
+ }
105
+ return concurrencyResults.every((group) => group.every((result) => result));
92
106
  }
93
107
  catch (error) {
94
108
  (0, hr_js_1.hr)();
package/package.json CHANGED
@@ -1,12 +1,19 @@
1
1
  {
2
2
  "name": "poku",
3
- "version": "1.11.0",
3
+ "version": "1.12.1",
4
4
  "description": "🐷 Poku makes testing easy for Node.js, Bun & Deno at the same time.",
5
5
  "main": "./lib/index.js",
6
6
  "scripts": {
7
- "test": "tsx src/bin/index.ts --parallel --debug --include=\"test/unit,test/integration,test/e2e\"",
8
- "test:bun": "bun src/bin/index.ts --parallel --platform=bun --debug --include=\"test/unit,test/integration,test/e2e\"",
9
- "test:c8": "c8 npm run test",
7
+ "test": "npm run test:parallel && npm run test:sequential",
8
+ "test:bun": "npm run test:bun:parallel && npm run test:bun:sequential",
9
+ "test:sequential": "tsx src/bin/index.ts --include=\"test/unit,test/integration,test/e2e\"",
10
+ "test:parallel": "npm run test:sequential -- --parallel",
11
+ "test:bun:sequential": "bun src/bin/index.ts --platform=\"bun\" --include=\"test/unit,test/integration,test/e2e\"",
12
+ "test:bun:parallel": "npm run test:bun:sequential -- --parallel",
13
+ "test:c8:sequential": "c8 tsx src/bin/index.ts --include=\"test/unit,test/integration,test/e2e\"",
14
+ "test:c8:parallel": "c8 tsx src/bin/index.ts --parallel --include=\"test/unit,test/integration,test/e2e\"",
15
+ "test:c8:sequential:options": "c8 tsx src/bin/index.ts --fast-fail --debug --exclude=\".bak\" --kill-port=\"4000\" --kill-range=\"4000-4001\" --include=\"test/unit,test/integration,test/e2e\"",
16
+ "test:c8:parallel:options": "c8 tsx src/bin/index.ts --parallel --concurrency=\"4\" --fast-fail --debug --exclude=\".bak\" --kill-port=\"4000\" --kill-range=\"4000-4001\" --include=\"test/unit,test/integration,test/e2e\"",
10
17
  "test:ci": "tsx ./test/ci.test.ts",
11
18
  "test:ci:node": "FILTER='node-' npm run test:ci",
12
19
  "test:ci:bun": "FILTER='bun-' npm run test:ci",
@@ -105,9 +112,9 @@
105
112
  ],
106
113
  "type": "commonjs",
107
114
  "devDependencies": {
108
- "@types/node": "^20.12.11",
109
- "@typescript-eslint/eslint-plugin": "^7.8.0",
110
- "@typescript-eslint/parser": "^7.8.0",
115
+ "@types/node": "^20.12.12",
116
+ "@typescript-eslint/eslint-plugin": "^7.9.0",
117
+ "@typescript-eslint/parser": "^7.9.0",
111
118
  "c8": "^9.1.0",
112
119
  "eslint": "^8.57.0",
113
120
  "eslint-config-prettier": "^9.1.0",
@@ -117,7 +124,7 @@
117
124
  "packages-update": "^1.2.1",
118
125
  "prettier": "^3.2.5",
119
126
  "shx": "^0.3.4",
120
- "tsx": "4.2.1",
127
+ "tsx": "4.10.5",
121
128
  "typescript": "^5.4.5"
122
129
  }
123
130
  }
File without changes
File without changes
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
+ /* c8 ignore start */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.padStart = void 0;
2
5
  /**
3
6
  * Custom implementations of `padStart` for compatibility with Node.js version 6.
4
7
  */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.padStart = void 0;
7
- /* c8 ignore start */
8
8
  const padStart = (str, targetLength, padString) => {
9
9
  padString = !padString ? ' ' : String(padString);
10
10
  if (str.length >= targetLength)