poku 2.2.4 → 2.3.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 +29 -6
- package/lib/bin/index.js +16 -2
- package/lib/configs/poku.d.ts +2 -1
- package/lib/configs/poku.js +2 -1
- package/lib/modules/essentials/poku.js +1 -4
- package/lib/modules/helpers/describe.d.ts +9 -5
- package/lib/modules/helpers/describe.js +6 -2
- package/lib/modules/helpers/exit.js +25 -1
- package/lib/modules/helpers/it/core.d.ts +8 -0
- package/lib/modules/helpers/{it.js → it/core.js} +10 -6
- package/lib/modules/helpers/it/todo.d.ts +1 -0
- package/lib/modules/helpers/it/todo.js +10 -0
- package/lib/modules/helpers/list-files.js +1 -1
- package/lib/modules/helpers/skip.js +3 -3
- package/lib/modules/helpers/test.d.ts +8 -2
- package/lib/modules/helpers/test.js +2 -2
- package/lib/modules/index.d.ts +1 -1
- package/lib/modules/index.js +2 -2
- package/lib/parsers/output.js +7 -3
- package/lib/services/format.d.ts +1 -0
- package/lib/services/format.js +4 -0
- package/lib/services/run-tests.js +1 -1
- package/lib/services/watch.js +8 -11
- package/package.json +4 -4
- package/lib/modules/helpers/it.d.ts +0 -4
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ Enjoying **Poku**? Give him a star to show your support 🌟
|
|
|
29
29
|
<img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Run **CommonJS** files directly with [**Deno**][deno-version-url]<br />
|
|
30
30
|
<img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Auto detect **ESM**, **CJS**, and **TypeScript** files<br />
|
|
31
31
|
<img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Run the **same test suite** for [**Node.js**][node-version-url], [**Bun**][bun-version-url], and [**Deno**][deno-version-url]<br />
|
|
32
|
-
<img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Easily handle **servers**, **processes**, **ports**, and **containers** ✨
|
|
32
|
+
<img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Easily handle **servers**, **processes**, **ports**, and even **containers** ✨
|
|
33
33
|
|
|
34
34
|
---
|
|
35
35
|
|
|
@@ -37,20 +37,43 @@ Enjoying **Poku**? Give him a star to show your support 🌟
|
|
|
37
37
|
|
|
38
38
|
### <img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Install
|
|
39
39
|
|
|
40
|
+
<table>
|
|
41
|
+
<tr>
|
|
42
|
+
<td width="225">
|
|
43
|
+
|
|
40
44
|
```bash
|
|
41
45
|
# Node.js
|
|
42
46
|
npm i -D poku
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
</td>
|
|
50
|
+
<td width="225">
|
|
43
51
|
|
|
52
|
+
```bash
|
|
44
53
|
# TypeScript (Node.js)
|
|
45
54
|
npm i -D poku tsx
|
|
55
|
+
```
|
|
46
56
|
|
|
57
|
+
</td>
|
|
58
|
+
<td width="225">
|
|
59
|
+
|
|
60
|
+
```bash
|
|
47
61
|
# Bun
|
|
48
62
|
bun add -d poku
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
</td>
|
|
66
|
+
<td width="225">
|
|
49
67
|
|
|
50
|
-
|
|
68
|
+
```bash
|
|
69
|
+
# Deno (optional)
|
|
51
70
|
deno add npm:poku
|
|
52
71
|
```
|
|
53
72
|
|
|
73
|
+
</td>
|
|
74
|
+
</tr>
|
|
75
|
+
</table>
|
|
76
|
+
|
|
54
77
|
---
|
|
55
78
|
|
|
56
79
|
### <img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Test
|
|
@@ -220,8 +243,8 @@ To see the detailed documentation, please visit the [**Documentation**](https://
|
|
|
220
243
|
|
|
221
244
|
- [Avoiding conflicts in environments with multiple platforms installed](https://poku.io/docs/tutorials/cross-platform#recommendations).
|
|
222
245
|
- [Properly running asynchronous tests on the same file](https://poku.io/docs/examples/promises).
|
|
223
|
-
- [Migrating from version **1.x** to version **2.x**](https://github.com/wellwelwel/poku/issues/533).
|
|
224
246
|
- [Using **Poku** without installing on **Deno** and alternatives to **JSR**](https://github.com/wellwelwel/poku/discussions/565).
|
|
247
|
+
- [Migrating from version **1.x** to version **2.x**](https://github.com/wellwelwel/poku/issues/533).
|
|
225
248
|
|
|
226
249
|
---
|
|
227
250
|
|
|
@@ -231,9 +254,9 @@ To see the detailed documentation, please visit the [**Documentation**](https://
|
|
|
231
254
|
|
|
232
255
|
**Poku** is [continuously tested](https://github.com/wellwelwel/poku/blob/main/.github/workflows/ci_benchmark.yml) to ensure the following expectations for basic usage:
|
|
233
256
|
|
|
234
|
-
-
|
|
235
|
-
-
|
|
236
|
-
-
|
|
257
|
+
- ~**4x** faster than [**Jest**](https://github.com/jestjs/jest) (v29.7.0)
|
|
258
|
+
- ~**3x** faster than [**Vitest**](https://github.com/vitest-dev/vitest) (v1.6.0)
|
|
259
|
+
- ~**1x** faster than [**Mocha**](https://github.com/mochajs/mocha) (v10.4.0) + [**Chai**](https://github.com/chaijs/chai) (v5.1.1)
|
|
237
260
|
|
|
238
261
|
> You can see how the tests are run and compared in the [benchmark](https://github.com/wellwelwel/poku/tree/main/benchmark) directory.
|
|
239
262
|
|
package/lib/bin/index.js
CHANGED
|
@@ -17,13 +17,15 @@ const watch_js_1 = require("../services/watch.js");
|
|
|
17
17
|
const poku_js_1 = require("../modules/essentials/poku.js");
|
|
18
18
|
const write_js_1 = require("../services/write.js");
|
|
19
19
|
const options_js_1 = require("../parsers/options.js");
|
|
20
|
+
const cpus_js_1 = require("../polyfills/cpus.js");
|
|
20
21
|
(async () => {
|
|
21
22
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
22
23
|
const configFile = (0, get_arg_js_1.getArg)('config') || (0, get_arg_js_1.getArg)('c', '-');
|
|
23
24
|
const defaultConfigs = await (0, options_js_1.getConfigs)(configFile);
|
|
24
25
|
const dirs = (() => {
|
|
25
26
|
var _a;
|
|
26
|
-
|
|
27
|
+
|
|
28
|
+
const includeArg = (0, get_arg_js_1.getArg)('include');
|
|
27
29
|
if (includeArg !== undefined) {
|
|
28
30
|
return includeArg.split(',');
|
|
29
31
|
}
|
|
@@ -37,11 +39,13 @@ const options_js_1 = require("../parsers/options.js");
|
|
|
37
39
|
const killPort = (0, get_arg_js_1.getArg)('kill-port');
|
|
38
40
|
const killRange = (0, get_arg_js_1.getArg)('kill-range');
|
|
39
41
|
const killPID = (0, get_arg_js_1.getArg)('kill-pid');
|
|
42
|
+
|
|
40
43
|
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;
|
|
41
44
|
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;
|
|
42
45
|
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)) ||
|
|
43
46
|
(0, get_arg_js_1.hasArg)('deno-cjs') ||
|
|
44
47
|
((_h = defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.deno) === null || _h === void 0 ? void 0 : _h.cjs);
|
|
48
|
+
|
|
45
49
|
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);
|
|
46
50
|
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);
|
|
47
51
|
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);
|
|
@@ -59,6 +63,7 @@ const options_js_1 = require("../parsers/options.js");
|
|
|
59
63
|
files_js_1.states.isSinglePath = true;
|
|
60
64
|
}
|
|
61
65
|
const tasks = [];
|
|
66
|
+
|
|
62
67
|
if (killPort || ((_j = defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.kill) === null || _j === void 0 ? void 0 : _j.port)) {
|
|
63
68
|
const ports = (killPort === null || killPort === void 0 ? void 0 : killPort.split(',').map(Number)) || ((_k = defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.kill) === null || _k === void 0 ? void 0 : _k.port) || [];
|
|
64
69
|
tasks.push(kill_js_1.kill.port(ports));
|
|
@@ -78,11 +83,13 @@ const options_js_1 = require("../parsers/options.js");
|
|
|
78
83
|
const PIDs = (killPID === null || killPID === void 0 ? void 0 : killPID.split(',').map(Number)) || ((_q = defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.kill) === null || _q === void 0 ? void 0 : _q.pid) || [];
|
|
79
84
|
tasks.push(kill_js_1.kill.pid(PIDs));
|
|
80
85
|
}
|
|
86
|
+
|
|
81
87
|
if (hasEnvFile || (defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.envFile)) {
|
|
82
88
|
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;
|
|
83
89
|
tasks.push((0, env_js_1.envFile)(envFilePath));
|
|
84
90
|
}
|
|
85
91
|
const options = {
|
|
92
|
+
|
|
86
93
|
platform: (0, get_runtime_js_1.platformIsValid)(platform)
|
|
87
94
|
? platform
|
|
88
95
|
: (0, get_arg_js_1.hasArg)('node')
|
|
@@ -123,6 +130,7 @@ const options_js_1 = require("../parsers/options.js");
|
|
|
123
130
|
const executing = new Set();
|
|
124
131
|
const interval = Number((0, get_arg_js_1.getArg)('watch-interval')) || 1500;
|
|
125
132
|
let isRunning = false;
|
|
133
|
+
|
|
126
134
|
const listenStdin = (input) => {
|
|
127
135
|
if (isRunning || executing.size > 0) {
|
|
128
136
|
return;
|
|
@@ -136,6 +144,7 @@ const options_js_1 = require("../parsers/options.js");
|
|
|
136
144
|
startTests();
|
|
137
145
|
}
|
|
138
146
|
};
|
|
147
|
+
|
|
139
148
|
const resultsClear = () => {
|
|
140
149
|
files_js_1.fileResults.success.clear();
|
|
141
150
|
files_js_1.fileResults.fail.clear();
|
|
@@ -149,6 +158,7 @@ const options_js_1 = require("../parsers/options.js");
|
|
|
149
158
|
(0, poku_js_1.poku)(dirs, options)
|
|
150
159
|
.then(() => {
|
|
151
160
|
if (watchMode) {
|
|
161
|
+
|
|
152
162
|
node_process_1.default.stdin.removeListener('data', listenStdin);
|
|
153
163
|
node_process_1.default.removeListener('SIGINT', poku_js_1.onSigint);
|
|
154
164
|
resultsClear();
|
|
@@ -166,7 +176,10 @@ const options_js_1 = require("../parsers/options.js");
|
|
|
166
176
|
if (!tests) {
|
|
167
177
|
return;
|
|
168
178
|
}
|
|
169
|
-
(0, poku_js_1.poku)(Array.from(tests),
|
|
179
|
+
(0, poku_js_1.poku)(Array.from(tests), {
|
|
180
|
+
...options,
|
|
181
|
+
concurrency: concurrency !== null && concurrency !== void 0 ? concurrency : Math.max(Math.floor((0, cpus_js_1.availableParallelism)() / 2), 1),
|
|
182
|
+
}).then(() => {
|
|
170
183
|
setTimeout(() => {
|
|
171
184
|
executing.delete(filePath);
|
|
172
185
|
}, interval);
|
|
@@ -195,6 +208,7 @@ const options_js_1 = require("../parsers/options.js");
|
|
|
195
208
|
}
|
|
196
209
|
write_js_1.Write.hr();
|
|
197
210
|
write_js_1.Write.log(`${(0, format_js_1.format)('Watching:').bold()} ${(0, format_js_1.format)(dirs.join(', ')).underline()}`);
|
|
211
|
+
|
|
198
212
|
node_process_1.default.stdin.setEncoding('utf-8');
|
|
199
213
|
node_process_1.default.stdin.on('data', listenStdin);
|
|
200
214
|
}
|
package/lib/configs/poku.d.ts
CHANGED
package/lib/configs/poku.js
CHANGED
|
@@ -17,14 +17,12 @@ const onSigint = () => {
|
|
|
17
17
|
node_process_1.default.stdout.write('\u001B[?25h');
|
|
18
18
|
};
|
|
19
19
|
exports.onSigint = onSigint;
|
|
20
|
-
|
|
21
20
|
node_process_1.default.once('SIGINT', exports.onSigint);
|
|
22
21
|
async function poku(targetPaths, configs) {
|
|
23
22
|
let code = 0;
|
|
24
23
|
files_js_1.finalResults.started = new Date();
|
|
25
24
|
const start = node_process_1.default.hrtime();
|
|
26
|
-
const
|
|
27
|
-
const dirs = prepareDirs.length > 0 ? prepareDirs : ['.'];
|
|
25
|
+
const dirs = Array.prototype.concat(targetPaths);
|
|
28
26
|
const showLogs = !(0, output_js_1.isQuiet)(configs);
|
|
29
27
|
|
|
30
28
|
if (!(configs === null || configs === void 0 ? void 0 : configs.parallel)) {
|
|
@@ -45,7 +43,6 @@ async function poku(targetPaths, configs) {
|
|
|
45
43
|
files_js_1.finalResults.time = total;
|
|
46
44
|
showLogs && (0, format_js_1.showTestResults)();
|
|
47
45
|
(0, exit_js_1.exit)(code, configs === null || configs === void 0 ? void 0 : configs.quiet);
|
|
48
|
-
return;
|
|
49
46
|
}
|
|
50
47
|
|
|
51
48
|
if (showLogs) {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { DescribeOptions } from '../../@types/describe.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
declare function describeCore(title: string, cb: () => Promise<unknown>): Promise<void>;
|
|
3
|
+
declare function describeCore(title: string, cb: () => unknown): void;
|
|
4
|
+
declare function describeCore(cb: () => Promise<unknown>): Promise<void>;
|
|
5
|
+
declare function describeCore(cb: () => unknown): unknown;
|
|
6
|
+
declare function describeCore(title: string, options?: DescribeOptions): void;
|
|
7
|
+
export declare const describe: typeof describeCore & {
|
|
8
|
+
todo: (message: string, _cb?: () => unknown) => void;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.describe =
|
|
3
|
+
exports.describe = void 0;
|
|
4
4
|
const node_process_1 = require("process");
|
|
5
5
|
const format_js_1 = require("../../services/format.js");
|
|
6
6
|
const write_js_1 = require("../../services/write.js");
|
|
7
7
|
const indentation_js_1 = require("../../configs/indentation.js");
|
|
8
|
-
|
|
8
|
+
const todo_js_1 = require("./it/todo.js");
|
|
9
|
+
async function describeCore(arg1, arg2) {
|
|
9
10
|
let title;
|
|
10
11
|
let cb;
|
|
11
12
|
let options;
|
|
@@ -51,3 +52,6 @@ async function describe(arg1, arg2) {
|
|
|
51
52
|
write_js_1.Write.log(`${(0, format_js_1.format)(`● ${title}`).success().bold()} ${(0, format_js_1.format)(`› ${total}ms`).success().dim()}`);
|
|
52
53
|
}
|
|
53
54
|
}
|
|
55
|
+
exports.describe = Object.assign(describeCore, {
|
|
56
|
+
todo: todo_js_1.todo,
|
|
57
|
+
});
|
|
@@ -12,6 +12,30 @@ const files_js_1 = require("../../configs/files.js");
|
|
|
12
12
|
const time_js_1 = require("../../parsers/time.js");
|
|
13
13
|
const exit = (code, quiet) => {
|
|
14
14
|
const isPoku = poku_js_1.results.success > 0 || poku_js_1.results.fail > 0;
|
|
15
|
+
const success = ` PASS › ${poku_js_1.results.success - poku_js_1.results.skip || 0} `;
|
|
16
|
+
const failure = ` FAIL › ${poku_js_1.results.fail} `;
|
|
17
|
+
const skips = ` SKIP › ${poku_js_1.results.skip} `;
|
|
18
|
+
const plans = ` TODO › ${poku_js_1.results.todo} `;
|
|
19
|
+
const inline = poku_js_1.results.skip === 0 || poku_js_1.results.todo === 0;
|
|
20
|
+
let message = '';
|
|
21
|
+
if (inline) {
|
|
22
|
+
message += `${(0, format_js_1.format)(success).bg('green')} ${(0, format_js_1.format)(failure).bg(poku_js_1.results.fail === 0 ? 'grey' : 'brightRed')}`;
|
|
23
|
+
if (poku_js_1.results.skip) {
|
|
24
|
+
message += ` ${(0, format_js_1.format)(skips).bg('brightBlue')}`;
|
|
25
|
+
}
|
|
26
|
+
if (poku_js_1.results.todo) {
|
|
27
|
+
message += ` ${(0, format_js_1.format)(plans).bg('brightBlue')}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
message += `${(0, format_js_1.format)(success).success().bold()}\n`;
|
|
32
|
+
message +=
|
|
33
|
+
poku_js_1.results.fail === 0
|
|
34
|
+
? (0, format_js_1.format)(`${failure}\n`).bold()
|
|
35
|
+
: `${(0, format_js_1.format)(failure).fail().bold()}\n`;
|
|
36
|
+
message += `${(0, format_js_1.format)(skips).info().bold()}\n`;
|
|
37
|
+
message += `${(0, format_js_1.format)(plans).info().bold()}`;
|
|
38
|
+
}
|
|
15
39
|
!quiet &&
|
|
16
40
|
node_process_1.default.on('exit', (code) => {
|
|
17
41
|
if (isPoku) {
|
|
@@ -20,7 +44,7 @@ const exit = (code, quiet) => {
|
|
|
20
44
|
write_js_1.Write.log(` ${(0, format_js_1.format)('Duration ›').dim()} ${(0, format_js_1.format)(`${files_js_1.finalResults.time}ms`).bold().dim()} ${(0, format_js_1.format)(`(±${(0, time_js_1.parseTimeToSecs)(files_js_1.finalResults.time)} seconds)`).dim()}`);
|
|
21
45
|
write_js_1.Write.log(` ${(0, format_js_1.format)(`Test Files › ${(0, format_js_1.format)(String(files_js_1.fileResults.success.size + files_js_1.fileResults.fail.size)).bold()}`).dim()}`);
|
|
22
46
|
write_js_1.Write.hr();
|
|
23
|
-
write_js_1.Write.log(
|
|
47
|
+
write_js_1.Write.log(message);
|
|
24
48
|
write_js_1.Write.hr();
|
|
25
49
|
}
|
|
26
50
|
write_js_1.Write.log(`${(0, format_js_1.format)('Exited with code').dim()} ${(0, format_js_1.format)(String(code)).bold()[code === 0 ? 'success' : 'fail']()}\n`);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare function itCore(message: string, cb: () => Promise<unknown>): Promise<void>;
|
|
2
|
+
declare function itCore(message: string, cb: () => unknown): void;
|
|
3
|
+
declare function itCore(cb: () => Promise<unknown>): Promise<void>;
|
|
4
|
+
declare function itCore(cb: () => unknown): void;
|
|
5
|
+
export declare const it: typeof itCore & {
|
|
6
|
+
todo: (message: string, _cb?: () => unknown) => void;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.it =
|
|
3
|
+
exports.it = void 0;
|
|
4
4
|
const node_process_1 = require("process");
|
|
5
|
-
const each_js_1 = require("
|
|
6
|
-
const indentation_js_1 = require("
|
|
7
|
-
const format_js_1 = require("
|
|
8
|
-
const write_js_1 = require("
|
|
9
|
-
|
|
5
|
+
const each_js_1 = require("../../../configs/each.js");
|
|
6
|
+
const indentation_js_1 = require("../../../configs/indentation.js");
|
|
7
|
+
const format_js_1 = require("../../../services/format.js");
|
|
8
|
+
const write_js_1 = require("../../../services/write.js");
|
|
9
|
+
const todo_js_1 = require("./todo.js");
|
|
10
|
+
async function itCore(...args) {
|
|
10
11
|
try {
|
|
11
12
|
let message;
|
|
12
13
|
let cb;
|
|
@@ -60,3 +61,6 @@ async function it(...args) {
|
|
|
60
61
|
throw error;
|
|
61
62
|
}
|
|
62
63
|
}
|
|
64
|
+
exports.it = Object.assign(itCore, {
|
|
65
|
+
todo: todo_js_1.todo,
|
|
66
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const todo: (message: string, _cb?: () => unknown) => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.todo = void 0;
|
|
4
|
+
const write_js_1 = require("../../../services/write.js");
|
|
5
|
+
const indentation_js_1 = require("../../../configs/indentation.js");
|
|
6
|
+
const format_js_1 = require("../../../services/format.js");
|
|
7
|
+
const todo = (message, _cb) => {
|
|
8
|
+
write_js_1.Write.log(`${indentation_js_1.indentation.hasDescribe ? ' ' : ''}${(0, format_js_1.format)(`● ${message}`).cyan().bold()}`);
|
|
9
|
+
};
|
|
10
|
+
exports.todo = todo;
|
|
@@ -54,7 +54,7 @@ const getAllFiles = async (dirPath, files = new Set(), configs) => {
|
|
|
54
54
|
const fullPath = isFullPath ? dirPath : (0, node_path_1.join)(dirPath, file);
|
|
55
55
|
const stat = await (0, fs_js_1.stat)(fullPath);
|
|
56
56
|
if (fullPath.indexOf('node_modules') !== -1 ||
|
|
57
|
-
fullPath.indexOf('.git')
|
|
57
|
+
fullPath.indexOf('.git/') !== -1) {
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
if (isFullPath && (files_js_1.states === null || files_js_1.states === void 0 ? void 0 : files_js_1.states.isSinglePath)) {
|
|
@@ -4,13 +4,13 @@ exports.skip = void 0;
|
|
|
4
4
|
const node_process_1 = require("process");
|
|
5
5
|
const write_js_1 = require("../../services/write.js");
|
|
6
6
|
const format_js_1 = require("../../services/format.js");
|
|
7
|
-
const skip = (message) => {
|
|
7
|
+
const skip = (message = 'Skipping') => {
|
|
8
8
|
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;
|
|
9
9
|
const FILE = node_process_1.env.FILE;
|
|
10
10
|
if (message) {
|
|
11
11
|
write_js_1.Write.log((0, format_js_1.format)(isPoku
|
|
12
|
-
?
|
|
13
|
-
:
|
|
12
|
+
? `◯ ${message} ${(0, format_js_1.format)('›').dim()} ${(0, format_js_1.format)(`${FILE}`).italic().gray().dim()}`
|
|
13
|
+
: `◯ ${message}`)
|
|
14
14
|
.info()
|
|
15
15
|
.bold());
|
|
16
16
|
}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare const test: {
|
|
2
|
+
(message: string, cb: () => Promise<unknown>): Promise<void>;
|
|
3
|
+
(message: string, cb: () => unknown): void;
|
|
4
|
+
(cb: () => Promise<unknown>): Promise<void>;
|
|
5
|
+
(cb: () => unknown): void;
|
|
6
|
+
} & {
|
|
7
|
+
todo: (message: string, _cb?: () => unknown) => void;
|
|
8
|
+
};
|
package/lib/modules/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { assert } from './essentials/assert.js';
|
|
|
4
4
|
export { strict } from './essentials/strict.js';
|
|
5
5
|
export { test } from './helpers/test.js';
|
|
6
6
|
export { describe } from './helpers/describe.js';
|
|
7
|
-
export { it } from './helpers/it.js';
|
|
7
|
+
export { it } from './helpers/it/core.js';
|
|
8
8
|
export { envFile } from './helpers/env.js';
|
|
9
9
|
export { skip } from './helpers/skip.js';
|
|
10
10
|
export { beforeEach, afterEach } from './helpers/each.js';
|
package/lib/modules/index.js
CHANGED
|
@@ -11,8 +11,8 @@ var test_js_1 = require("./helpers/test.js");
|
|
|
11
11
|
Object.defineProperty(exports, "test", { enumerable: true, get: function () { return test_js_1.test; } });
|
|
12
12
|
var describe_js_1 = require("./helpers/describe.js");
|
|
13
13
|
Object.defineProperty(exports, "describe", { enumerable: true, get: function () { return describe_js_1.describe; } });
|
|
14
|
-
var
|
|
15
|
-
Object.defineProperty(exports, "it", { enumerable: true, get: function () { return
|
|
14
|
+
var core_js_1 = require("./helpers/it/core.js");
|
|
15
|
+
Object.defineProperty(exports, "it", { enumerable: true, get: function () { return core_js_1.it; } });
|
|
16
16
|
var env_js_1 = require("./helpers/env.js");
|
|
17
17
|
Object.defineProperty(exports, "envFile", { enumerable: true, get: function () { return env_js_1.envFile; } });
|
|
18
18
|
var skip_js_1 = require("./helpers/skip.js");
|
package/lib/parsers/output.js
CHANGED
|
@@ -5,7 +5,8 @@ const poku_js_1 = require("../configs/poku.js");
|
|
|
5
5
|
const regex = {
|
|
6
6
|
newLine: /\n/,
|
|
7
7
|
ansi: /u001b\[0m|\n/i,
|
|
8
|
-
|
|
8
|
+
skip: /\\u001b\[94m\\u001b\[1m◯/i,
|
|
9
|
+
todo: /\\u001b\[96m\\u001b\[1m●/i,
|
|
9
10
|
};
|
|
10
11
|
const isQuiet = (configs) => typeof (configs === null || configs === void 0 ? void 0 : configs.quiet) === 'boolean' && Boolean(configs === null || configs === void 0 ? void 0 : configs.quiet);
|
|
11
12
|
exports.isQuiet = isQuiet;
|
|
@@ -14,8 +15,11 @@ exports.isDebug = isDebug;
|
|
|
14
15
|
const parserOutput = (options) => {
|
|
15
16
|
const { output, result, configs } = options;
|
|
16
17
|
const normalizedOutput = JSON.stringify(output);
|
|
17
|
-
if (regex.
|
|
18
|
-
++poku_js_1.results.
|
|
18
|
+
if (regex.skip.test(normalizedOutput)) {
|
|
19
|
+
++poku_js_1.results.skip;
|
|
20
|
+
}
|
|
21
|
+
if (regex.todo.test(normalizedOutput)) {
|
|
22
|
+
++poku_js_1.results.todo;
|
|
19
23
|
}
|
|
20
24
|
const debug = (0, exports.isDebug)(configs);
|
|
21
25
|
const pad = (configs === null || configs === void 0 ? void 0 : configs.parallel) ? ' ' : ' ';
|
package/lib/services/format.d.ts
CHANGED
package/lib/services/format.js
CHANGED
|
@@ -65,7 +65,7 @@ const runTestsParallel = async (dir, configs) => {
|
|
|
65
65
|
const testDir = (0, node_path_1.join)(cwd, dir);
|
|
66
66
|
const files = await (0, list_files_js_1.listFiles)(testDir, configs);
|
|
67
67
|
const filesByConcurrency = [];
|
|
68
|
-
const concurrencyLimit = (_a = configs === null || configs === void 0 ? void 0 : configs.concurrency) !== null && _a !== void 0 ? _a : Math.max(
|
|
68
|
+
const concurrencyLimit = (_a = configs === null || configs === void 0 ? void 0 : configs.concurrency) !== null && _a !== void 0 ? _a : Math.max((0, cpus_js_1.availableParallelism)() - 1, 1);
|
|
69
69
|
const concurrencyResults = [];
|
|
70
70
|
const showLogs = !(0, output_js_1.isQuiet)(configs);
|
|
71
71
|
if (concurrencyLimit > 0) {
|
package/lib/services/watch.js
CHANGED
|
@@ -62,18 +62,15 @@ class Watcher {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
async start() {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
this.watchFile(this.rootDir);
|
|
74
|
-
}
|
|
65
|
+
const stats = await (0, fs_js_1.stat)(this.rootDir);
|
|
66
|
+
if (stats.isDirectory()) {
|
|
67
|
+
this.files = await (0, list_files_js_1.listFiles)(this.rootDir);
|
|
68
|
+
this.watchFiles(this.files);
|
|
69
|
+
await this.watchDirectory(this.rootDir);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
this.watchFile(this.rootDir);
|
|
75
73
|
}
|
|
76
|
-
catch (_a) { }
|
|
77
74
|
}
|
|
78
75
|
stop() {
|
|
79
76
|
this.unwatchFiles();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poku",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.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",
|
|
@@ -62,13 +62,13 @@
|
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@biomejs/biome": "1.8.3",
|
|
65
|
-
"@types/node": "^
|
|
65
|
+
"@types/node": "^22.0.0",
|
|
66
66
|
"c8": "^10.1.2",
|
|
67
67
|
"jsonc.min": "^1.0.0",
|
|
68
|
-
"monocart-coverage-reports": "^2.
|
|
68
|
+
"monocart-coverage-reports": "^2.10.0",
|
|
69
69
|
"packages-update": "^2.0.0",
|
|
70
70
|
"prettier": "^3.3.3",
|
|
71
|
-
"tsx": "4.16.
|
|
71
|
+
"tsx": "4.16.3",
|
|
72
72
|
"typescript": "^5.5.4"
|
|
73
73
|
},
|
|
74
74
|
"keywords": [
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare function it(message: string, cb: () => Promise<unknown>): Promise<void>;
|
|
2
|
-
export declare function it(message: string, cb: () => unknown): void;
|
|
3
|
-
export declare function it(cb: () => Promise<unknown>): Promise<void>;
|
|
4
|
-
export declare function it(cb: () => unknown): void;
|