poku 2.4.2 → 2.4.4

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,7 +6,7 @@
6
6
  Enjoying **Poku**? Give him a star to show your support 🌟
7
7
 
8
8
  [![NPM Downloads](https://img.shields.io/npm/v/poku.svg?label=&color=70a1ff&logo=npm&logoColor=white)](https://www.npmjs.com/package/poku)
9
- [![NPM Downloads](https://img.shields.io/npm/dt/poku.svg?label=&logo=npm&logoColor=white&color=45aaf2)](https://www.npmjs.com/package/poku)
9
+ [![NPM Downloads](https://img.shields.io/npm/dm/poku.svg?label=&logo=npm&logoColor=white&color=45aaf2)](https://www.npmjs.com/package/poku)
10
10
  [![Coverage](https://img.shields.io/codecov/c/github/wellwelwel/poku?label=&logo=codecov&logoColor=white&color=98cc00)](https://github.com/wellwelwel/poku/tree/main/.nycrc)<br />
11
11
  [![GitHub Workflow Status (Linux)](https://img.shields.io/github/actions/workflow/status/wellwelwel/poku/ci_coverage-linux.yml?event=push&label=&branch=main&logo=ubuntu&logoColor=8897a9&color=dfe4ea)](https://github.com/wellwelwel/poku/actions/workflows/ci_coverage-linux.yml?query=branch%3Amain)
12
12
  [![GitHub Workflow Status (OSX)](https://img.shields.io/github/actions/workflow/status/wellwelwel/poku/ci_coverage-osx.yml?event=push&label=&branch=main&logo=apple&logoColor=8897a9&color=dfe4ea)](https://github.com/wellwelwel/poku/actions/workflows/ci_coverage-osx.yml?query=branch%3Amain)
@@ -270,7 +270,7 @@ To see the detailed documentation, please visit the [**Documentation**](https://
270
270
  - [~**130x** lighter than **Jest**](https://pkg-size.dev/jest)
271
271
  - [~**30x** lighter than **Mocha** + **Chai**](https://pkg-size.dev/mocha%20chai)
272
272
 
273
- > **Poku** size is highly significant in development to ensure cost-saving **CI** that require servers that charge for storage and usage.
273
+ > **Poku** size ensures _cost-saving_ **CI** for services that charge for storage and usage.
274
274
 
275
275
  ---
276
276
 
package/lib/bin/watch.js CHANGED
@@ -90,7 +90,7 @@ const startWatch = async (dirs, options) => {
90
90
  }
91
91
  write_js_1.Write.hr();
92
92
  write_js_1.Write.log(`${(0, format_js_1.format)('Watching:').bold()} ${(0, format_js_1.format)(dirs.join(', ')).underline()}`);
93
- node_process_1.default.stdin.setEncoding('utf-8');
93
+ node_process_1.default.stdin.setEncoding('utf8');
94
94
  node_process_1.default.stdin.on('data', listenStdin);
95
95
  };
96
96
  exports.startWatch = startWatch;
@@ -1,6 +1,6 @@
1
1
  import type { ProcessAssertionOptions } from '../@types/assert.js';
2
- import type assert from 'node:assert';
3
- import type { AssertPredicate } from 'node:assert';
2
+ import type assert from "assert";
3
+ import type { AssertPredicate } from "assert";
4
4
  export declare const createAssert: (nodeAssert: typeof assert) => ((value: unknown, message?: ProcessAssertionOptions["message"]) => void) & {
5
5
  ok: (value: unknown, message?: ProcessAssertionOptions["message"]) => void;
6
6
  equal: (actual: unknown, expected: unknown, message?: ProcessAssertionOptions["message"]) => void;
@@ -7,4 +7,4 @@ exports.results = {
7
7
  skip: 0,
8
8
  todo: 0,
9
9
  };
10
- exports.VERSION = '2.4.2';
10
+ exports.VERSION = '2.4.4';
@@ -1,4 +1,4 @@
1
- import nodeAssert from 'node:assert';
1
+ import nodeAssert from "assert";
2
2
  export declare const assert: ((value: unknown, message?: import("../../@types/assert.js").ProcessAssertionOptions["message"]) => void) & {
3
3
  ok: (value: unknown, message?: import("../../@types/assert.js").ProcessAssertionOptions["message"]) => void;
4
4
  equal: (actual: unknown, expected: unknown, message?: import("../../@types/assert.js").ProcessAssertionOptions["message"]) => void;
@@ -25,6 +25,8 @@ const backgroundProcess = (runtime, args, file, options) => new Promise((resolve
25
25
  windowsHide: get_runner_js_1.isWindows,
26
26
  });
27
27
  const PID = service.pid;
28
+ service.stdout.setEncoding('utf8');
29
+ service.stderr.setEncoding('utf8');
28
30
  let portBackup;
29
31
  const end = (port) => new Promise((resolve) => {
30
32
  try {
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.envFile = void 0;
4
+ const node_process_1 = require("process");
4
5
  const fs_js_1 = require("../../polyfills/fs.js");
5
6
  const list_files_js_1 = require("./list-files.js");
6
7
  const env_js_1 = require("../../services/env.js");
@@ -19,11 +20,11 @@ const envFile = async (filePath = '.env') => {
19
20
  const parsedLine = (0, env_js_1.parseEnvLine)(line);
20
21
  if (parsedLine) {
21
22
  const { arg, value } = parsedLine;
22
- mapEnv.set(arg, value ? (0, env_js_1.resolveEnvVariables)(value, process.env) : value);
23
+ mapEnv.set(arg, value ? (0, env_js_1.resolveEnvVariables)(value, node_process_1.env) : value);
23
24
  }
24
25
  }
25
26
  for (const [arg, value] of mapEnv) {
26
- process.env[arg] = value;
27
+ node_process_1.env[arg] = value;
27
28
  }
28
29
  };
29
30
  exports.envFile = envFile;
@@ -21,7 +21,7 @@ const getConfigs = async (customPath) => {
21
21
  if (filePath.endsWith('.js') || filePath.endsWith('.cjs')) {
22
22
  return require(`file://${(0, node_path_1.normalize)(filePath)}`);
23
23
  }
24
- const configsFile = await (0, fs_js_1.readFile)(filePath, 'utf-8');
24
+ const configsFile = await (0, fs_js_1.readFile)(filePath, 'utf8');
25
25
  return jsonc_js_1.JSONC.parse(configsFile);
26
26
  }
27
27
  catch (_a) { }
@@ -1,4 +1,4 @@
1
- import { stat as nodeStat, readdir as nodeReaddir, readFile as nodeReadFile } from 'node:fs';
1
+ import { stat as nodeStat, readdir as nodeReaddir, readFile as nodeReadFile } from "fs";
2
2
  export declare const readdir: typeof nodeReaddir.__promisify__;
3
3
  export declare const stat: typeof nodeStat.__promisify__;
4
4
  export declare const readFile: typeof nodeReadFile.__promisify__;
@@ -1,27 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
@@ -29,18 +6,19 @@ var _a;
29
6
  Object.defineProperty(exports, "__esModule", { value: true });
30
7
  exports.processAsyncAssert = exports.processAssert = void 0;
31
8
  const node_assert_1 = require("assert");
32
- const node_process_1 = __importStar(require("process"));
9
+ const node_process_1 = __importDefault(require("process"));
33
10
  const node_path_1 = __importDefault(require("path"));
34
11
  const find_file_from_stack_js_1 = require("../parsers/find-file-from-stack.js");
35
12
  const assert_js_1 = require("../parsers/assert.js");
36
13
  const indentation_js_1 = require("../configs/indentation.js");
37
14
  const format_js_1 = require("./format.js");
38
15
  const write_js_1 = require("./write.js");
39
- const cwd = (0, node_process_1.cwd)();
16
+ const cwd = node_process_1.default.cwd();
40
17
  const regexFile = /file:(\/\/)?/;
41
18
  const assertProcessor = () => {
42
- const isPoku = typeof (node_process_1.env === null || node_process_1.env === void 0 ? void 0 : node_process_1.env.FILE) === 'string' && (node_process_1.env === null || node_process_1.env === void 0 ? void 0 : node_process_1.env.FILE.length) > 0;
43
- const FILE = node_process_1.env.FILE;
19
+ var _a, _b;
20
+ 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;
21
+ const FILE = node_process_1.default.env.FILE;
44
22
  let preIdentation = '';
45
23
  const handleSuccess = (options) => {
46
24
  if (typeof options.message === 'string') {
@@ -12,6 +12,8 @@ const runDockerCommand = (command, args, options, verbose) => {
12
12
  shell: get_runner_js_1.isWindows,
13
13
  });
14
14
  if (verbose) {
15
+ dockerProcess.stdout.setEncoding('utf8');
16
+ dockerProcess.stderr.setEncoding('utf8');
15
17
  dockerProcess.stdout.on('data', write_js_1.Write.log);
16
18
  dockerProcess.stderr.on('data', write_js_1.Write.log);
17
19
  }
@@ -86,10 +86,11 @@ const getLargestStringLength = (arr) => arr.reduce((max, current) => Math.max(ma
86
86
  exports.getLargestStringLength = getLargestStringLength;
87
87
  const showTestResults = () => {
88
88
  write_js_1.Write.hr();
89
- if (files_js_1.fileResults.success.size > 0) {
89
+ if (files_js_1.fileResults.success.size > 0 && files_js_1.fileResults.fail.size === 0) {
90
90
  write_js_1.Write.log(Array.from(files_js_1.fileResults.success)
91
91
  .map(([file, time]) => `${indentation_js_1.indentation.test}${(0, exports.format)('✔').success()} ${(0, exports.format)(`${file} ${(0, exports.format)(`› ${time}ms`).success()}`).dim()}`)
92
92
  .join('\n'));
93
+ return;
93
94
  }
94
95
  if (files_js_1.fileResults.fail.size > 0) {
95
96
  write_js_1.Write.log(Array.from(files_js_1.fileResults.fail)
@@ -72,7 +72,7 @@ const processDeepImports = async (srcFile, testFile, intersectedSrcFiles) => {
72
72
  return;
73
73
  }
74
74
  processedFiles.add(srcFile);
75
- const srcContent = await (0, fs_js_1.readFile)(srcFile, 'utf-8');
75
+ const srcContent = await (0, fs_js_1.readFile)(srcFile, 'utf8');
76
76
  const deepImports = (0, exports.getDeepImports)(srcContent);
77
77
  const matchingFiles = (0, exports.findMatchingFiles)(deepImports, intersectedSrcFiles);
78
78
  for (const deepImport of matchingFiles) {
@@ -88,7 +88,7 @@ const createImportMap = async (allTestFiles, allSrcFiles) => {
88
88
  const intersectedSrcFiles = new Set(Array.from(allSrcFiles).filter((srcFile) => !allTestFiles.has(srcFile)));
89
89
  await Promise.all(Array.from(allTestFiles).map(async (testFile) => {
90
90
  var _a;
91
- const content = await (0, fs_js_1.readFile)(testFile, 'utf-8');
91
+ const content = await (0, fs_js_1.readFile)(testFile, 'utf8');
92
92
  for (const srcFile of intersectedSrcFiles) {
93
93
  const relativePath = (0, exports.normalizePath)((0, node_path_1.relative)((0, node_path_1.dirname)(testFile), srcFile));
94
94
  const normalizedSrcFile = (0, exports.normalizePath)(srcFile);
@@ -50,6 +50,8 @@ const runTestFile = async (filePath, configs) => {
50
50
  FILE: (configs === null || configs === void 0 ? void 0 : configs.parallel) || ((_a = configs === null || configs === void 0 ? void 0 : configs.deno) === null || _a === void 0 ? void 0 : _a.cjs) ? fileRelative : '',
51
51
  },
52
52
  });
53
+ child.stdout.setEncoding('utf8');
54
+ child.stderr.setEncoding('utf8');
53
55
  child.stdout.on('data', stdOut);
54
56
  child.stderr.on('data', stdOut);
55
57
  child.on('close', async (code) => {
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.runTestsParallel = exports.runTests = void 0;
4
- const node_process_1 = require("process");
7
+ const node_process_1 = __importDefault(require("process"));
5
8
  const node_path_1 = require("path");
6
9
  const get_runner_js_1 = require("../parsers/get-runner.js");
7
10
  const indentation_js_1 = require("../configs/indentation.js");
@@ -12,7 +15,7 @@ const run_test_file_js_1 = require("./run-test-file.js");
12
15
  const output_js_1 = require("../parsers/output.js");
13
16
  const poku_js_1 = require("../configs/poku.js");
14
17
  const cpus_js_1 = require("../polyfills/cpus.js");
15
- const cwd = (0, node_process_1.cwd)();
18
+ const cwd = node_process_1.default.cwd();
16
19
  const runTests = async (dir, configs) => {
17
20
  const testDir = (0, node_path_1.join)(cwd, dir);
18
21
  const currentDir = (0, node_path_1.relative)(cwd, testDir);
@@ -28,9 +31,9 @@ const runTests = async (dir, configs) => {
28
31
  for (let i = 0; i < files.length; i++) {
29
32
  const filePath = files[i];
30
33
  const fileRelative = (0, node_path_1.relative)(cwd, filePath);
31
- const start = (0, node_process_1.hrtime)();
34
+ const start = node_process_1.default.hrtime();
32
35
  const testPassed = await (0, run_test_file_js_1.runTestFile)(filePath, configs);
33
- const end = (0, node_process_1.hrtime)(start);
36
+ const end = node_process_1.default.hrtime(start);
34
37
  const total = (end[0] * 1e3 + end[1] / 1e6).toFixed(6);
35
38
  const testNumber = i + 1;
36
39
  const counter = (0, format_js_1.format)('').counter(testNumber, totalTests);
@@ -49,6 +52,7 @@ const runTests = async (dir, configs) => {
49
52
  }
50
53
  passed = false;
51
54
  if (configs === null || configs === void 0 ? void 0 : configs.failFast) {
55
+ node_process_1.default.exitCode = 1;
52
56
  if (showLogs) {
53
57
  write_js_1.Write.hr();
54
58
  write_js_1.Write.log(` ${(0, format_js_1.format)('ℹ').fail()} ${(0, format_js_1.format)('fail-fast').bold()} is enabled`);
@@ -83,6 +87,7 @@ const runTestsParallel = async (dir, configs) => {
83
87
  if (!testPassed) {
84
88
  ++poku_js_1.results.fail;
85
89
  if (configs === null || configs === void 0 ? void 0 : configs.failFast) {
90
+ node_process_1.default.exitCode = 1;
86
91
  throw new Error(` ${(0, format_js_1.format)('ℹ').fail()} ${(0, format_js_1.format)('fail-fast').bold()} is enabled`);
87
92
  }
88
93
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poku",
3
- "version": "2.4.2",
3
+ "version": "2.4.4",
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",
@@ -37,21 +37,16 @@
37
37
  "test:parallel": "tsx src/bin/index.ts -p test/unit test/integration test/e2e",
38
38
  "test:bun:sequential": "bun src/bin/index.ts --bun test/unit test/integration test/e2e",
39
39
  "test:bun:parallel": "bun src/bin/index.ts --bun -p test/unit test/integration test/e2e",
40
- "test:deno:sequential": "tsx src/bin/index.ts --deno --deno-allow=all --deno-cjs ci/test/unit ci/test/integration ci/test/e2e",
41
- "test:deno:parallel": "tsx src/bin/index.ts --deno --deno-allow=all --deno-cjs -p ci/test/unit ci/test/integration ci/test/e2e",
40
+ "test:deno:sequential": "tsx src/bin/index.ts --deno --deno-allow=all test/unit test/integration test/e2e",
41
+ "test:deno:parallel": "tsx src/bin/index.ts --deno --deno-allow=all -p test/unit test/integration test/e2e",
42
42
  "pretest:c8": "tsx tools/build/c8-file.ts",
43
43
  "test:c8": "c8 --experimental-monocart tsx test/c8.test.ts",
44
44
  "posttest:c8": "rm -rf ./.nycrc.json",
45
- "test:ci": "tsx test/ci.test.ts",
46
- "test:ci:node": "FILTER='node-' npm run test:ci",
47
- "test:ci:bun": "FILTER='bun-' npm run test:ci",
48
- "test:ci:deno": "FILTER='deno-' npm run test:ci",
49
- "predocker:deno": "docker compose -f test/docker/playground/deno/docker-compose.yml down",
50
- "docker:deno": "docker compose -f test/docker/playground/deno/docker-compose.yml up --build",
45
+ "test:docker:node": "tsx test/ci.test.ts",
51
46
  "clear": "rm -rf lib ci coverage .temp test-src test-tests",
52
47
  "prebuild": "npm run clear",
53
- "build": "tsc && tsc -p tsconfig.test.json",
54
- "postbuild": "tsx tools/compatibility/node.ts && tsx tools/compatibility/comments.ts && tsx tools/build/version.ts && cp fixtures/server/package.json ci/fixtures/server/package.json && rm -f ./lib/@types/*.js ./lib/bin/*.ts && npm run build:deno && chmod +x lib/bin/index.js",
48
+ "build": "tsc && cd test && tsc",
49
+ "postbuild": "tsx tools/compatibility/node.ts && tsx tools/compatibility/comments.ts && tsx tools/build/version.ts && cp test/__fixtures__/e2e/server/package.json ci/test/__fixtures__/e2e/server/package.json && rm -f ./lib/@types/*.js ./lib/bin/*.ts && npm run build:deno && chmod +x lib/bin/index.js",
55
50
  "build:deno": "tsc -p tsconfig.mjs.json",
56
51
  "postbuild:deno": "tsx tools/build/check-deno-polyfill.ts",
57
52
  "lint": "npx @biomejs/biome lint && prettier --check .",
@@ -62,13 +57,13 @@
62
57
  },
63
58
  "devDependencies": {
64
59
  "@biomejs/biome": "1.8.3",
65
- "@types/node": "^22.1.0",
60
+ "@types/node": "^22.2.0",
66
61
  "c8": "^10.1.2",
67
62
  "jsonc.min": "^1.0.0",
68
- "monocart-coverage-reports": "^2.10.1",
63
+ "monocart-coverage-reports": "^2.10.2",
69
64
  "packages-update": "^2.0.0",
70
65
  "prettier": "^3.3.3",
71
- "tsx": "4.16.5",
66
+ "tsx": "4.17.0",
72
67
  "typescript": "^5.5.4"
73
68
  },
74
69
  "keywords": [