poku 2.4.4 → 2.5.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.
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkFlags = void 0;
4
+ const node_process_1 = require("process");
5
+ const write_js_1 = require("../services/write.js");
6
+ const format_js_1 = require("../services/format.js");
7
+ const checkFlags = () => {
8
+ const allowedFlags = new Set([
9
+ '--bun',
10
+ '--concurrency',
11
+ '--config',
12
+ '--debug',
13
+ '--deno',
14
+ '--denoAllow',
15
+ '--denoCjs',
16
+ '--denoDeny',
17
+ '--enforce',
18
+ '--envFile',
19
+ '--exclude',
20
+ '--failFast',
21
+ '--filter',
22
+ '--killPid',
23
+ '--killPort',
24
+ '--killRange',
25
+ '--node',
26
+ '--parallel',
27
+ '--platform',
28
+ '--quiet',
29
+ '--watch',
30
+ '--watchInterval',
31
+ '-c',
32
+ '-d',
33
+ '-p',
34
+ '-q',
35
+ '-w',
36
+ '-x',
37
+ ]);
38
+ const args = node_process_1.argv.slice(2);
39
+ const unrecognizedFlags = [];
40
+ for (const arg of args) {
41
+ const flagName = arg.split('=')[0];
42
+ if (!allowedFlags.has(flagName) && flagName.startsWith('-')) {
43
+ unrecognizedFlags.push(flagName);
44
+ }
45
+ }
46
+ if (unrecognizedFlags.length > 0) {
47
+ write_js_1.Write.hr();
48
+ write_js_1.Write.log(`${(0, format_js_1.format)('Unrecognized flags:').bold()}\n\n${unrecognizedFlags.map((flag) => (0, format_js_1.format)(flag).fail()).join('\n')}`);
49
+ write_js_1.Write.hr();
50
+ (0, node_process_1.exit)(1);
51
+ }
52
+ };
53
+ exports.checkFlags = checkFlags;
package/lib/bin/index.js CHANGED
@@ -18,6 +18,7 @@ const options_js_1 = require("../parsers/options.js");
18
18
  write_js_1.Write.log(VERSION);
19
19
  return;
20
20
  }
21
+ const enforce = (0, get_arg_js_1.hasArg)('enforce') || (0, get_arg_js_1.hasArg)('x', '-');
21
22
  const configFile = (0, get_arg_js_1.getArg)('config') || (0, get_arg_js_1.getArg)('c', '-');
22
23
  const defaultConfigs = await (0, options_js_1.getConfigs)(configFile);
23
24
  const dirs = (() => {
@@ -34,22 +35,22 @@ const options_js_1 = require("../parsers/options.js");
34
35
  const platform = (0, get_arg_js_1.getArg)('platform');
35
36
  const filter = (_a = (0, get_arg_js_1.getArg)('filter')) !== null && _a !== void 0 ? _a : defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.filter;
36
37
  const exclude = (_b = (0, get_arg_js_1.getArg)('exclude')) !== null && _b !== void 0 ? _b : defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.exclude;
37
- const killPort = (0, get_arg_js_1.getArg)('kill-port');
38
- const killRange = (0, get_arg_js_1.getArg)('kill-range');
39
- const killPID = (0, get_arg_js_1.getArg)('kill-pid');
38
+ const killPort = (0, get_arg_js_1.getArg)('killport');
39
+ const killRange = (0, get_arg_js_1.getArg)('killrange');
40
+ const killPID = (0, get_arg_js_1.getArg)('killpid');
40
41
 
41
- const denoAllow = (_c = (0, get_arg_js_1.argToArray)('deno-allow')) !== null && _c !== void 0 ? _c : (_d = defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.deno) === null || _d === void 0 ? void 0 : _d.allow;
42
- const denoDeny = (_e = (0, get_arg_js_1.argToArray)('deno-deny')) !== null && _e !== void 0 ? _e : (_f = defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.deno) === null || _f === void 0 ? void 0 : _f.deny;
43
- const denoCJS = ((_g = (0, get_arg_js_1.getArg)('deno-cjs')) === null || _g === void 0 ? void 0 : _g.split(',').map((a) => a.trim()).filter((a) => a)) ||
44
- (0, get_arg_js_1.hasArg)('deno-cjs') ||
42
+ const denoAllow = (_c = (0, get_arg_js_1.argToArray)('denoallow')) !== null && _c !== void 0 ? _c : (_d = defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.deno) === null || _d === void 0 ? void 0 : _d.allow;
43
+ const denoDeny = (_e = (0, get_arg_js_1.argToArray)('denodeny')) !== null && _e !== void 0 ? _e : (_f = defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.deno) === null || _f === void 0 ? void 0 : _f.deny;
44
+ const denoCJS = ((_g = (0, get_arg_js_1.getArg)('denocjs')) === null || _g === void 0 ? void 0 : _g.split(',').map((a) => a.trim()).filter((a) => a)) ||
45
+ (0, get_arg_js_1.hasArg)('denocjs') ||
45
46
  ((_h = defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.deno) === null || _h === void 0 ? void 0 : _h.cjs);
46
47
 
47
48
  const parallel = (0, get_arg_js_1.hasArg)('parallel') || (0, get_arg_js_1.hasArg)('p', '-') || (defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.parallel);
48
49
  const quiet = (0, get_arg_js_1.hasArg)('quiet') || (0, get_arg_js_1.hasArg)('q', '-') || (defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.quiet);
49
50
  const debug = (0, get_arg_js_1.hasArg)('debug') || (0, get_arg_js_1.hasArg)('d', '-') || (defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.debug);
50
- const failFast = (0, get_arg_js_1.hasArg)('fail-fast') || (defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.failFast);
51
+ const failFast = (0, get_arg_js_1.hasArg)('failfast') || (defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.failFast);
51
52
  const watchMode = (0, get_arg_js_1.hasArg)('watch') || (0, get_arg_js_1.hasArg)('w', '-');
52
- const hasEnvFile = (0, get_arg_js_1.hasArg)('env-file');
53
+ const hasEnvFile = (0, get_arg_js_1.hasArg)('envfile');
53
54
  const concurrency = (() => {
54
55
  if (!(parallel || (defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.parallel))) {
55
56
  return undefined;
@@ -60,7 +61,7 @@ const options_js_1 = require("../parsers/options.js");
60
61
  if (dirs.length === 1) {
61
62
  files_js_1.states.isSinglePath = true;
62
63
  }
63
- if ((0, get_arg_js_1.hasArg)('list-files')) {
64
+ if ((0, get_arg_js_1.hasArg)('listfiles')) {
64
65
  const { listFiles } = require('../modules/helpers/list-files.js');
65
66
  const files = [];
66
67
  write_js_1.Write.hr();
@@ -83,6 +84,10 @@ const options_js_1 = require("../parsers/options.js");
83
84
  write_js_1.Write.hr();
84
85
  return;
85
86
  }
87
+ if (enforce) {
88
+ const { checkFlags } = require('./enforce.js');
89
+ checkFlags();
90
+ }
86
91
  const tasks = [];
87
92
 
88
93
  if (killPort || ((_j = defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.kill) === null || _j === void 0 ? void 0 : _j.port)) {
@@ -106,7 +111,7 @@ const options_js_1 = require("../parsers/options.js");
106
111
  }
107
112
 
108
113
  if (hasEnvFile || (defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.envFile)) {
109
- const envFilePath = (_r = (0, get_arg_js_1.getArg)('env-file')) !== null && _r !== void 0 ? _r : defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.envFile;
114
+ const envFilePath = (_r = (0, get_arg_js_1.getArg)('envfile')) !== null && _r !== void 0 ? _r : defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.envFile;
110
115
  tasks.push((0, env_js_1.envFile)(envFilePath));
111
116
  }
112
117
  const options = {
package/lib/bin/watch.js CHANGED
@@ -17,7 +17,7 @@ const startWatch = async (dirs, options) => {
17
17
  let isRunning = false;
18
18
  const watchers = new Set();
19
19
  const executing = new Set();
20
- const interval = Number((0, get_arg_js_1.getArg)('watch-interval')) || 1500;
20
+ const interval = Number((0, get_arg_js_1.getArg)('watchinterval')) || 1500;
21
21
  const setIsRunning = (value) => {
22
22
  isRunning = value;
23
23
  };
@@ -7,4 +7,4 @@ exports.results = {
7
7
  skip: 0,
8
8
  todo: 0,
9
9
  };
10
- exports.VERSION = '2.4.4';
10
+ exports.VERSION = '2.5.0';
@@ -6,7 +6,7 @@ const node_assert_1 = require("assert");
6
6
  const checkPort = (port, host) => new Promise((resolve) => {
7
7
  const client = (0, node_net_1.createConnection)(port, host);
8
8
  client.on('connect', () => {
9
- client.destroy();
9
+ client.end();
10
10
  resolve(true);
11
11
  });
12
12
  client.on('error', () => {
@@ -2,9 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.argToArray = exports.getPaths = exports.hasArg = exports.getArg = void 0;
4
4
  const node_process_1 = require("process");
5
+ const to_dynamic_case_js_1 = require("./to-dynamic-case.js");
5
6
  const [, , ...processArgs] = node_process_1.argv;
6
7
  const regexQuotes = /''|""/;
7
- const getArg = (arg, prefix = '--', baseArgs = processArgs) => {
8
+ const processedArgs = processArgs.map(to_dynamic_case_js_1.toDynamicCase);
9
+ const getArg = (arg, prefix = '--', baseArgs = processedArgs) => {
8
10
  const argPattern = `${prefix}${arg}=`;
9
11
  const argValue = baseArgs.find((a) => a.startsWith(argPattern));
10
12
  if (!argValue) {
@@ -13,12 +15,12 @@ const getArg = (arg, prefix = '--', baseArgs = processArgs) => {
13
15
  return argValue.slice(argPattern.length).replace(regexQuotes, '');
14
16
  };
15
17
  exports.getArg = getArg;
16
- const hasArg = (arg, prefix = '--', baseArgs = processArgs) => {
18
+ const hasArg = (arg, prefix = '--', baseArgs = processedArgs) => {
17
19
  const argPattern = `${prefix}${arg}`;
18
20
  return baseArgs.some((a) => a.startsWith(argPattern));
19
21
  };
20
22
  exports.hasArg = hasArg;
21
- const getPaths = (prefix = '--', baseArgs = processArgs) => {
23
+ const getPaths = (prefix = '--', baseArgs = processedArgs) => {
22
24
  let hasPaths = false;
23
25
  const paths = [];
24
26
  for (const arg of baseArgs) {
@@ -33,7 +35,7 @@ const getPaths = (prefix = '--', baseArgs = processArgs) => {
33
35
  return hasPaths ? paths : undefined;
34
36
  };
35
37
  exports.getPaths = getPaths;
36
- const argToArray = (arg, prefix = '--', baseArgs = processArgs) => {
38
+ const argToArray = (arg, prefix = '--', baseArgs = processedArgs) => {
37
39
  const hasArgument = (0, exports.hasArg)(arg, prefix, baseArgs);
38
40
  if (!hasArgument) {
39
41
  return undefined;
@@ -0,0 +1 @@
1
+ export declare const toDynamicCase: (str: string) => string;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toDynamicCase = void 0;
4
+ const regex = /-/g;
5
+ const toDynamicCase = (str) => {
6
+
7
+ if (str[1] !== '-') {
8
+ return str;
9
+ }
10
+ const [flag, ...args] = str.slice(2).split('=');
11
+ const dynamicCase = flag.toLowerCase().replace(regex, '');
12
+ let processArg = `--${dynamicCase}`;
13
+ if (args.length > 0) {
14
+ processArg += `=${args.join('=')}`;
15
+ }
16
+ return processArg;
17
+ };
18
+ exports.toDynamicCase = toDynamicCase;
@@ -55,7 +55,7 @@ const runTests = async (dir, configs) => {
55
55
  node_process_1.default.exitCode = 1;
56
56
  if (showLogs) {
57
57
  write_js_1.Write.hr();
58
- write_js_1.Write.log(` ${(0, format_js_1.format)('ℹ').fail()} ${(0, format_js_1.format)('fail-fast').bold()} is enabled`);
58
+ write_js_1.Write.log(` ${(0, format_js_1.format)('ℹ').fail()} ${(0, format_js_1.format)('failFast').bold()} is enabled`);
59
59
  }
60
60
  break;
61
61
  }
@@ -88,7 +88,7 @@ const runTestsParallel = async (dir, configs) => {
88
88
  ++poku_js_1.results.fail;
89
89
  if (configs === null || configs === void 0 ? void 0 : configs.failFast) {
90
90
  node_process_1.default.exitCode = 1;
91
- throw new Error(` ${(0, format_js_1.format)('ℹ').fail()} ${(0, format_js_1.format)('fail-fast').bold()} is enabled`);
91
+ throw new Error(` ${(0, format_js_1.format)('ℹ').fail()} ${(0, format_js_1.format)('failFast').bold()} is enabled`);
92
92
  }
93
93
  return false;
94
94
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poku",
3
- "version": "2.4.4",
3
+ "version": "2.5.0",
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,8 +37,8 @@
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 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",
40
+ "test:deno:sequential": "tsx src/bin/index.ts --deno --denoAllow=all test/unit test/integration test/e2e",
41
+ "test:deno:parallel": "tsx src/bin/index.ts --deno --denoAllow=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",
@@ -57,10 +57,10 @@
57
57
  },
58
58
  "devDependencies": {
59
59
  "@biomejs/biome": "1.8.3",
60
- "@types/node": "^22.2.0",
60
+ "@types/node": "^22.4.1",
61
61
  "c8": "^10.1.2",
62
62
  "jsonc.min": "^1.0.0",
63
- "monocart-coverage-reports": "^2.10.2",
63
+ "monocart-coverage-reports": "^2.10.3",
64
64
  "packages-update": "^2.0.0",
65
65
  "prettier": "^3.3.3",
66
66
  "tsx": "4.17.0",