poku 2.2.2 → 2.2.3

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.
@@ -0,0 +1 @@
1
+ export declare const availableParallelism: () => number;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.availableParallelism = void 0;
4
+ const node_os_1 = require("os");
5
+ const availableParallelism = () => {
6
+ var _a, _b;
7
+ return typeof node_os_1.availableParallelism === 'function'
8
+ ? Math.floor((0, node_os_1.availableParallelism)() / 2)
9
+ : ((_b = (_a = (0, node_os_1.cpus)()) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 1);
10
+ };
11
+ exports.availableParallelism = availableParallelism;
@@ -41,8 +41,8 @@ const processAssert = async (cb, options) => {
41
41
  catch (error) {
42
42
  if (error instanceof node_assert_1.AssertionError) {
43
43
  const { code, actual, expected, operator } = error;
44
- const absoultePath = (0, find_file_from_stack_js_1.findFile)(error).replace(regexFile, '');
45
- const file = node_path_1.default.relative(node_path_1.default.resolve(cwd), absoultePath);
44
+ const absolutePath = (0, find_file_from_stack_js_1.findFile)(error).replace(regexFile, '');
45
+ const file = node_path_1.default.relative(node_path_1.default.resolve(cwd), absolutePath);
46
46
  let message = '';
47
47
  if (typeof options.message === 'string') {
48
48
  message = options.message;
@@ -55,7 +55,7 @@ const processAssert = async (cb, options) => {
55
55
  }
56
56
  const finalMessage = (message === null || message === void 0 ? void 0 : message.trim().length) > 0
57
57
  ? (0, format_js_1.format)(`✘ ${message}`).fail().bold()
58
- : (0, format_js_1.format)('✘ No Message').fail().bold();
58
+ : (0, format_js_1.format)('✘ Assertion Error').fail().bold();
59
59
  write_js_1.Write.log(isPoku
60
60
  ? `${preIdentation}${finalMessage} ${(0, format_js_1.format)(`› ${FILE}`).fail().dim()}`
61
61
  : `${preIdentation}${finalMessage}`);
@@ -11,6 +11,7 @@ const format_js_1 = require("./format.js");
11
11
  const run_test_file_js_1 = require("./run-test-file.js");
12
12
  const output_js_1 = require("../parsers/output.js");
13
13
  const poku_js_1 = require("../configs/poku.js");
14
+ const cpus_js_1 = require("../polyfills/cpus.js");
14
15
  const cwd = (0, node_process_1.cwd)();
15
16
  const runTests = async (dir, configs) => {
16
17
  const testDir = (0, node_path_1.join)(cwd, dir);
@@ -65,12 +66,13 @@ const runTests = async (dir, configs) => {
65
66
  exports.runTests = runTests;
66
67
  /* c8 ignore next */ // ?
67
68
  const runTestsParallel = async (dir, configs) => {
69
+ var _a;
68
70
  const testDir = (0, node_path_1.join)(cwd, dir);
69
71
  const files = (await (0, list_files_js_1.isFile)(dir))
70
72
  ? [(0, list_files_js_1.sanitizePath)(dir)]
71
73
  : await (0, list_files_js_1.listFiles)(testDir, configs);
72
74
  const filesByConcurrency = [];
73
- const concurrencyLimit = (configs === null || configs === void 0 ? void 0 : configs.concurrency) || 0;
75
+ const concurrencyLimit = (_a = configs === null || configs === void 0 ? void 0 : configs.concurrency) !== null && _a !== void 0 ? _a : (0, cpus_js_1.availableParallelism)();
74
76
  const concurrencyResults = [];
75
77
  const showLogs = !(0, output_js_1.isQuiet)(configs);
76
78
  if (concurrencyLimit > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poku",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "🐷 Poku makes testing easy for Node.js, Bun, Deno, and you at the same time.",
5
5
  "main": "./lib/modules/index.js",
6
6
  "license": "MIT",