poku 3.0.0 → 3.0.1-canary.d486f01
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 +1 -1
- package/lib/@types/poku.d.ts +1 -1
- package/lib/bin/index.js +14 -15
- package/lib/bin/watch.js +11 -11
- package/lib/builders/assert.d.ts +1 -1
- package/lib/configs/poku.d.ts +1 -2
- package/lib/configs/poku.js +2 -2
- package/lib/modules/essentials/poku.js +10 -11
- package/lib/modules/helpers/create-service.js +5 -5
- package/lib/modules/helpers/describe.d.ts +1 -1
- package/lib/modules/helpers/describe.js +3 -3
- package/lib/modules/helpers/env.js +2 -2
- package/lib/modules/helpers/exit.js +2 -3
- package/lib/modules/helpers/it/core.d.ts +1 -1
- package/lib/modules/helpers/it/core.js +2 -2
- package/lib/modules/helpers/list-files.js +2 -2
- package/lib/modules/helpers/modifiers.js +5 -5
- package/lib/modules/helpers/wait-for.js +1 -1
- package/lib/parsers/get-runtime.js +1 -1
- package/lib/parsers/options.js +2 -2
- package/lib/polyfills/deno.mjs +2 -2
- package/lib/services/container.js +2 -2
- package/lib/services/each.js +2 -2
- package/lib/services/enforce.js +3 -3
- package/lib/services/map-tests.js +1 -1
- package/lib/services/reporter.js +3 -3
- package/lib/services/reporters/classic.js +2 -2
- package/lib/services/reporters/compact.js +3 -3
- package/lib/services/reporters/dot.js +2 -2
- package/lib/services/reporters/focus.js +2 -2
- package/lib/services/reporters/poku.js +6 -6
- package/lib/services/run-test-file.js +4 -4
- package/lib/services/run-tests.js +22 -27
- package/lib/services/watch.js +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -250,7 +250,7 @@ To see the detailed documentation, please visit the [**Documentation**](https://
|
|
|
250
250
|
- [Avoiding conflicts in environments with multiple platforms installed](https://poku.io/docs/tutorials/cross-platform#recommendations).
|
|
251
251
|
- [Properly running asynchronous tests on the same file](https://poku.io/docs/examples/promises).
|
|
252
252
|
- [Using **Poku** without installing on **Deno** and alternatives to **JSR**](https://github.com/wellwelwel/poku/discussions/565).
|
|
253
|
-
- [Migrating from version **2.x** to version **3.x**
|
|
253
|
+
- [Migrating from version **2.x** to version **3.x**](https://github.com/wellwelwel/poku/issues/801).
|
|
254
254
|
|
|
255
255
|
---
|
|
256
256
|
|
package/lib/@types/poku.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { AssertionError } from "assert";
|
|
2
2
|
import type { results } from '../configs/poku.js';
|
|
3
|
-
import type { Configs as ListFilesConfigs } from './list-files.js';
|
|
4
3
|
import type { ProcessAssertionOptions } from './assert.js';
|
|
5
4
|
import type { DescribeOptions } from './describe.js';
|
|
5
|
+
import type { Configs as ListFilesConfigs } from './list-files.js';
|
|
6
6
|
type CustomString = string & NonNullable<unknown>;
|
|
7
7
|
export type DenoOptions = {
|
|
8
8
|
allow?: string[];
|
package/lib/bin/index.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const poku_js_1 = require("../configs/poku.js");
|
|
5
|
+
const poku_js_2 = require("../modules/essentials/poku.js");
|
|
6
|
+
const env_js_1 = require("../modules/helpers/env.js");
|
|
7
|
+
const kill_js_1 = require("../modules/helpers/kill.js");
|
|
4
8
|
const list_files_js_1 = require("../modules/helpers/list-files.js");
|
|
5
9
|
const get_arg_js_1 = require("../parsers/get-arg.js");
|
|
6
|
-
const
|
|
10
|
+
const options_js_1 = require("../parsers/options.js");
|
|
7
11
|
const format_js_1 = require("../services/format.js");
|
|
8
|
-
const kill_js_1 = require("../modules/helpers/kill.js");
|
|
9
|
-
const env_js_1 = require("../modules/helpers/env.js");
|
|
10
|
-
const poku_js_2 = require("../modules/essentials/poku.js");
|
|
11
12
|
const write_js_1 = require("../services/write.js");
|
|
12
|
-
const options_js_1 = require("../parsers/options.js");
|
|
13
|
-
const poku_js_3 = require("../configs/poku.js");
|
|
14
13
|
(async () => {
|
|
15
14
|
|
|
16
15
|
if ((0, get_arg_js_1.hasArg)('version') || (0, get_arg_js_1.hasArg)('v', '-')) {
|
|
17
|
-
(0, write_js_1.log)(
|
|
16
|
+
(0, write_js_1.log)(poku_js_1.VERSION);
|
|
18
17
|
return;
|
|
19
18
|
}
|
|
20
19
|
if ((0, get_arg_js_1.hasArg)('help') || (0, get_arg_js_1.hasArg)('h', '-')) {
|
|
@@ -23,8 +22,8 @@ const poku_js_3 = require("../configs/poku.js");
|
|
|
23
22
|
}
|
|
24
23
|
const enforce = (0, get_arg_js_1.hasArg)('enforce') || (0, get_arg_js_1.hasArg)('x', '-');
|
|
25
24
|
const configFile = (0, get_arg_js_1.getArg)('config') || (0, get_arg_js_1.getArg)('c', '-');
|
|
26
|
-
|
|
27
|
-
const { configsFromFile } =
|
|
25
|
+
poku_js_1.GLOBAL.configsFromFile = await (0, options_js_1.getConfigs)(configFile);
|
|
26
|
+
const { configsFromFile } = poku_js_1.GLOBAL;
|
|
28
27
|
const dirs = (0, get_arg_js_1.getPaths)('-') ??
|
|
29
28
|
(configsFromFile?.include
|
|
30
29
|
? Array.prototype.concat(configsFromFile?.include)
|
|
@@ -36,7 +35,7 @@ const poku_js_3 = require("../configs/poku.js");
|
|
|
36
35
|
const killPID = (0, get_arg_js_1.getArg)('killPid');
|
|
37
36
|
const reporter = (0, get_arg_js_1.getArg)('reporter') ??
|
|
38
37
|
(0, get_arg_js_1.getArg)('r', '-') ??
|
|
39
|
-
|
|
38
|
+
poku_js_1.GLOBAL.configsFromFile.reporter ??
|
|
40
39
|
'poku';
|
|
41
40
|
|
|
42
41
|
const denoAllow = (0, get_arg_js_1.argToArray)('denoAllow') ?? configsFromFile?.deno?.allow;
|
|
@@ -82,8 +81,8 @@ const poku_js_3 = require("../configs/poku.js");
|
|
|
82
81
|
(0, write_js_1.hr)();
|
|
83
82
|
return;
|
|
84
83
|
}
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
poku_js_1.GLOBAL.configFile = configFile;
|
|
85
|
+
poku_js_1.GLOBAL.configs = {
|
|
87
86
|
filter: typeof filter === 'string' ? new RegExp((0, list_files_js_1.escapeRegExp)(filter)) : filter,
|
|
88
87
|
exclude: typeof exclude === 'string' ? new RegExp((0, list_files_js_1.escapeRegExp)(exclude)) : exclude,
|
|
89
88
|
concurrency,
|
|
@@ -103,7 +102,7 @@ const poku_js_3 = require("../configs/poku.js");
|
|
|
103
102
|
};
|
|
104
103
|
const tasks = [];
|
|
105
104
|
if (hasEnvFile || configsFromFile?.envFile) {
|
|
106
|
-
|
|
105
|
+
poku_js_1.GLOBAL.envFile = (0, get_arg_js_1.getArg)('envFile') ?? configsFromFile?.envFile ?? '.env';
|
|
107
106
|
}
|
|
108
107
|
if (enforce)
|
|
109
108
|
require('../services/enforce.js').enforce();
|
|
@@ -128,12 +127,12 @@ const poku_js_3 = require("../configs/poku.js");
|
|
|
128
127
|
tasks.push(kill_js_1.kill.pid(PIDs));
|
|
129
128
|
}
|
|
130
129
|
|
|
131
|
-
|
|
130
|
+
poku_js_1.GLOBAL.envFile && tasks.push((0, env_js_1.envFile)(poku_js_1.GLOBAL.envFile));
|
|
132
131
|
if (debug || configsFromFile?.debug) {
|
|
133
132
|
(0, write_js_1.hr)();
|
|
134
133
|
(0, write_js_1.log)(`${(0, format_js_1.format)(' Debug Enabled ').bg('brightBlue')}\n`);
|
|
135
134
|
(0, write_js_1.log)(`${(0, format_js_1.format)('…').info().italic()} ${(0, format_js_1.format)('Options').bold()}`);
|
|
136
|
-
console.dir(
|
|
135
|
+
console.dir(poku_js_1.GLOBAL.configs, {
|
|
137
136
|
depth: Number.POSITIVE_INFINITY,
|
|
138
137
|
colors: true,
|
|
139
138
|
});
|
package/lib/bin/watch.js
CHANGED
|
@@ -4,19 +4,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.startWatch = void 0;
|
|
7
|
-
const map_tests_js_1 = require("../services/map-tests.js");
|
|
8
|
-
const watch_js_1 = require("../services/watch.js");
|
|
9
|
-
const poku_js_1 = require("../modules/essentials/poku.js");
|
|
10
|
-
const write_js_1 = require("../services/write.js");
|
|
11
7
|
const node_process_1 = __importDefault(require("process"));
|
|
12
|
-
const
|
|
8
|
+
const poku_js_1 = require("../configs/poku.js");
|
|
9
|
+
const poku_js_2 = require("../modules/essentials/poku.js");
|
|
13
10
|
const get_arg_js_1 = require("../parsers/get-arg.js");
|
|
14
11
|
const os_js_1 = require("../polyfills/os.js");
|
|
15
|
-
const
|
|
12
|
+
const format_js_1 = require("../services/format.js");
|
|
13
|
+
const map_tests_js_1 = require("../services/map-tests.js");
|
|
16
14
|
const poku_js_3 = require("../services/reporters/poku.js");
|
|
15
|
+
const watch_js_1 = require("../services/watch.js");
|
|
16
|
+
const write_js_1 = require("../services/write.js");
|
|
17
17
|
const startWatch = async (dirs) => {
|
|
18
18
|
let isRunning = false;
|
|
19
|
-
const { configs } =
|
|
19
|
+
const { configs } = poku_js_1.GLOBAL;
|
|
20
20
|
const watchers = new Set();
|
|
21
21
|
const executing = new Set();
|
|
22
22
|
const interval = Number((0, get_arg_js_1.getArg)('watchInterval')) || 1500;
|
|
@@ -34,11 +34,11 @@ const startWatch = async (dirs) => {
|
|
|
34
34
|
watcher.stop();
|
|
35
35
|
watchers.clear();
|
|
36
36
|
resultsClear();
|
|
37
|
-
await (0,
|
|
37
|
+
await (0, poku_js_2.poku)(dirs);
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
node_process_1.default.stdin.removeListener('data', listenStdin);
|
|
41
|
-
node_process_1.default.removeListener('SIGINT',
|
|
41
|
+
node_process_1.default.removeListener('SIGINT', poku_js_2.onSigint);
|
|
42
42
|
resultsClear();
|
|
43
43
|
const mappedTests = await (0, map_tests_js_1.mapTests)('.', dirs, configs.filter, configs.exclude);
|
|
44
44
|
for (const mappedTest of Array.from(mappedTests.keys())) {
|
|
@@ -53,7 +53,7 @@ const startWatch = async (dirs) => {
|
|
|
53
53
|
const tests = mappedTests.get(filePath);
|
|
54
54
|
if (!tests)
|
|
55
55
|
return;
|
|
56
|
-
await (0,
|
|
56
|
+
await (0, poku_js_2.poku)(Array.from(tests), {
|
|
57
57
|
...configs,
|
|
58
58
|
concurrency: configs.concurrency ??
|
|
59
59
|
Math.max(Math.floor((0, os_js_1.availableParallelism)() / 2), 1),
|
|
@@ -74,7 +74,7 @@ const startWatch = async (dirs) => {
|
|
|
74
74
|
setIsRunning(true);
|
|
75
75
|
executing.add(file);
|
|
76
76
|
resultsClear();
|
|
77
|
-
(0,
|
|
77
|
+
(0, poku_js_2.poku)(file).then(() => setTimeout(() => {
|
|
78
78
|
executing.delete(file);
|
|
79
79
|
setIsRunning(false);
|
|
80
80
|
}, interval));
|
package/lib/builders/assert.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ProcessAssertionOptions } from '../@types/assert.js';
|
|
2
1
|
import type assert from "assert";
|
|
3
2
|
import type { AssertPredicate } from "assert";
|
|
3
|
+
import type { ProcessAssertionOptions } from '../@types/assert.js';
|
|
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;
|
package/lib/configs/poku.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ConfigFile, ConfigJSONFile, Configs, Runtime } from '../@types/poku.js';
|
|
1
|
+
import type { ConfigFile, ConfigJSONFile, Configs, Runtime, States, Timespan } from '../@types/poku.js';
|
|
3
2
|
export declare const states: States;
|
|
4
3
|
export declare const timespan: Timespan;
|
|
5
4
|
export declare const results: {
|
package/lib/configs/poku.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GLOBAL = exports.deepOptions = exports.VERSION = exports.results = exports.timespan = exports.states = void 0;
|
|
4
4
|
const node_process_1 = require("process");
|
|
5
|
-
const reporter_js_1 = require("../services/reporter.js");
|
|
6
5
|
const get_runtime_js_1 = require("../parsers/get-runtime.js");
|
|
6
|
+
const reporter_js_1 = require("../services/reporter.js");
|
|
7
7
|
exports.states = Object.create(null);
|
|
8
8
|
exports.timespan = Object.create(null);
|
|
9
9
|
exports.results = {
|
|
@@ -12,7 +12,7 @@ exports.results = {
|
|
|
12
12
|
skipped: 0,
|
|
13
13
|
todo: 0,
|
|
14
14
|
};
|
|
15
|
-
exports.VERSION = '3.0.
|
|
15
|
+
exports.VERSION = '3.0.1-canary.d486f01';
|
|
16
16
|
exports.deepOptions = [];
|
|
17
17
|
exports.GLOBAL = {
|
|
18
18
|
cwd: (0, node_process_1.cwd)(),
|
|
@@ -6,11 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.onSigint = void 0;
|
|
7
7
|
exports.poku = poku;
|
|
8
8
|
const node_process_1 = __importDefault(require("process"));
|
|
9
|
-
const exit_js_1 = require("../helpers/exit.js");
|
|
10
9
|
const poku_js_1 = require("../../configs/poku.js");
|
|
11
|
-
const run_tests_js_1 = require("../../services/run-tests.js");
|
|
12
|
-
const poku_js_2 = require("../../configs/poku.js");
|
|
13
10
|
const reporter_js_1 = require("../../services/reporter.js");
|
|
11
|
+
const run_tests_js_1 = require("../../services/run-tests.js");
|
|
12
|
+
const exit_js_1 = require("../helpers/exit.js");
|
|
14
13
|
|
|
15
14
|
const onSigint = () => node_process_1.default.stdout.write('\u001B[?25h');
|
|
16
15
|
exports.onSigint = onSigint;
|
|
@@ -18,16 +17,16 @@ node_process_1.default.once('SIGINT', exports.onSigint);
|
|
|
18
17
|
async function poku(targetPaths, configs) {
|
|
19
18
|
let code = 0;
|
|
20
19
|
if (configs)
|
|
21
|
-
|
|
20
|
+
poku_js_1.GLOBAL.configs = { ...poku_js_1.GLOBAL.configs, ...configs };
|
|
22
21
|
poku_js_1.timespan.started = new Date();
|
|
23
22
|
const start = node_process_1.default.hrtime();
|
|
24
23
|
const paths = Array.prototype.concat(targetPaths);
|
|
25
|
-
const showLogs = !
|
|
26
|
-
const { reporter: plugin } =
|
|
24
|
+
const showLogs = !poku_js_1.GLOBAL.configs.quiet;
|
|
25
|
+
const { reporter: plugin } = poku_js_1.GLOBAL.configs;
|
|
27
26
|
if (typeof plugin === 'string' && plugin !== 'poku')
|
|
28
|
-
|
|
27
|
+
poku_js_1.GLOBAL.reporter = reporter_js_1.reporter[plugin]();
|
|
29
28
|
if (showLogs)
|
|
30
|
-
|
|
29
|
+
poku_js_1.GLOBAL.reporter.onRunStart();
|
|
31
30
|
try {
|
|
32
31
|
const promises = paths.map(async (dir) => await (0, run_tests_js_1.runTests)(dir));
|
|
33
32
|
const concurrency = await Promise.all(promises);
|
|
@@ -41,8 +40,8 @@ async function poku(targetPaths, configs) {
|
|
|
41
40
|
poku_js_1.timespan.finished = new Date();
|
|
42
41
|
}
|
|
43
42
|
if (showLogs)
|
|
44
|
-
|
|
45
|
-
if (
|
|
43
|
+
poku_js_1.GLOBAL.reporter.onRunResult({ code, timespan: poku_js_1.timespan, results: poku_js_1.results });
|
|
44
|
+
if (poku_js_1.GLOBAL.configs.noExit)
|
|
46
45
|
return code;
|
|
47
|
-
(0, exit_js_1.exit)(code,
|
|
46
|
+
(0, exit_js_1.exit)(code, poku_js_1.GLOBAL.configs.quiet);
|
|
48
47
|
}
|
|
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.startScript = exports.startService = void 0;
|
|
7
|
-
const node_process_1 = __importDefault(require("process"));
|
|
8
7
|
const node_child_process_1 = require("child_process");
|
|
9
|
-
const get_runner_js_1 = require("../../parsers/get-runner.js");
|
|
10
8
|
const node_path_1 = require("path");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const write_js_1 = require("../../services/write.js");
|
|
9
|
+
const node_process_1 = __importDefault(require("process"));
|
|
10
|
+
const get_runner_js_1 = require("../../parsers/get-runner.js");
|
|
14
11
|
const os_js_1 = require("../../parsers/os.js");
|
|
12
|
+
const write_js_1 = require("../../services/write.js");
|
|
13
|
+
const kill_js_1 = require("./kill.js");
|
|
14
|
+
const list_files_js_1 = require("./list-files.js");
|
|
15
15
|
const runningProcesses = new Map();
|
|
16
16
|
const backgroundProcess = (runtime, args, file, options) => new Promise((resolve, reject) => {
|
|
17
17
|
try {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DescribeOptions } from '../../@types/describe.js';
|
|
2
|
-
import {
|
|
2
|
+
import { onlyDescribe, skip, todo } from './modifiers.js';
|
|
3
3
|
export declare function describeBase(arg1: string | (() => unknown | Promise<unknown>), arg2?: (() => unknown | Promise<unknown>) | DescribeOptions): Promise<void>;
|
|
4
4
|
declare function describeCore(message: string, cb: () => Promise<unknown>): Promise<void>;
|
|
5
5
|
declare function describeCore(message: string, cb: () => unknown): void;
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.describe = void 0;
|
|
4
4
|
exports.describeBase = describeBase;
|
|
5
5
|
const node_process_1 = require("process");
|
|
6
|
-
const modifiers_js_1 = require("./modifiers.js");
|
|
7
|
-
const get_arg_js_1 = require("../../parsers/get-arg.js");
|
|
8
|
-
const callback_js_1 = require("../../parsers/callback.js");
|
|
9
6
|
const poku_js_1 = require("../../configs/poku.js");
|
|
7
|
+
const callback_js_1 = require("../../parsers/callback.js");
|
|
8
|
+
const get_arg_js_1 = require("../../parsers/get-arg.js");
|
|
9
|
+
const modifiers_js_1 = require("./modifiers.js");
|
|
10
10
|
async function describeBase(arg1, arg2) {
|
|
11
11
|
let title;
|
|
12
12
|
let cb;
|
|
@@ -1,10 +1,10 @@
|
|
|
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");
|
|
5
4
|
const promises_1 = require("fs/promises");
|
|
6
|
-
const
|
|
5
|
+
const node_process_1 = require("process");
|
|
7
6
|
const env_js_1 = require("../../services/env.js");
|
|
7
|
+
const list_files_js_1 = require("./list-files.js");
|
|
8
8
|
const regex = {
|
|
9
9
|
comment: /^\s*#/,
|
|
10
10
|
};
|
|
@@ -4,16 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.exit = void 0;
|
|
7
|
+
const node_assert_1 = require("assert");
|
|
7
8
|
const node_process_1 = __importDefault(require("process"));
|
|
8
9
|
const poku_js_1 = require("../../configs/poku.js");
|
|
9
|
-
const poku_js_2 = require("../../configs/poku.js");
|
|
10
|
-
const node_assert_1 = require("assert");
|
|
11
10
|
const exit = (code, quiet) => {
|
|
12
11
|
const isPoku = poku_js_1.results.passed > 0 || poku_js_1.results.failed > 0;
|
|
13
12
|
if (!quiet && isPoku)
|
|
14
13
|
poku_js_1.GLOBAL.reporter.onExit({
|
|
15
14
|
code,
|
|
16
|
-
timespan:
|
|
15
|
+
timespan: poku_js_1.timespan,
|
|
17
16
|
results: poku_js_1.results,
|
|
18
17
|
});
|
|
19
18
|
node_process_1.default.exitCode = code === 0 ? 0 : 1;
|
|
@@ -5,9 +5,9 @@ exports.itBase = itBase;
|
|
|
5
5
|
const node_process_1 = require("process");
|
|
6
6
|
const each_js_1 = require("../../../configs/each.js");
|
|
7
7
|
const indentation_js_1 = require("../../../configs/indentation.js");
|
|
8
|
-
const modifiers_js_1 = require("../modifiers.js");
|
|
9
|
-
const get_arg_js_1 = require("../../../parsers/get-arg.js");
|
|
10
8
|
const poku_js_1 = require("../../../configs/poku.js");
|
|
9
|
+
const get_arg_js_1 = require("../../../parsers/get-arg.js");
|
|
10
|
+
const modifiers_js_1 = require("../modifiers.js");
|
|
11
11
|
async function itBase(...args) {
|
|
12
12
|
try {
|
|
13
13
|
let title;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.listFiles = exports.getAllFiles = exports.escapeRegExp = exports.isFile = exports.sanitizePath = void 0;
|
|
4
|
-
const node_process_1 = require("process");
|
|
5
|
-
const node_path_1 = require("path");
|
|
6
4
|
const promises_1 = require("fs/promises");
|
|
5
|
+
const node_path_1 = require("path");
|
|
6
|
+
const node_process_1 = require("process");
|
|
7
7
|
const poku_js_1 = require("../../configs/poku.js");
|
|
8
8
|
const regex = {
|
|
9
9
|
sep: /[/\\]+/g,
|
|
@@ -5,13 +5,13 @@ exports.skip = skip;
|
|
|
5
5
|
exports.onlyDescribe = onlyDescribe;
|
|
6
6
|
exports.onlyIt = onlyIt;
|
|
7
7
|
const node_process_1 = require("process");
|
|
8
|
-
const
|
|
8
|
+
const poku_js_1 = require("../../configs/poku.js");
|
|
9
|
+
const callback_js_1 = require("../../parsers/callback.js");
|
|
10
|
+
const get_arg_js_1 = require("../../parsers/get-arg.js");
|
|
9
11
|
const format_js_1 = require("../../services/format.js");
|
|
10
|
-
const
|
|
12
|
+
const write_js_1 = require("../../services/write.js");
|
|
11
13
|
const describe_js_1 = require("./describe.js");
|
|
12
|
-
const
|
|
13
|
-
const callback_js_1 = require("../../parsers/callback.js");
|
|
14
|
-
const poku_js_1 = require("../../configs/poku.js");
|
|
14
|
+
const core_js_1 = require("./it/core.js");
|
|
15
15
|
async function todo(messageOrCb, _cb) {
|
|
16
16
|
const message = typeof messageOrCb === 'string' ? messageOrCb : 'Planning';
|
|
17
17
|
poku_js_1.GLOBAL.reporter.onTodoModifier({ message });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.waitForPort = exports.waitForExpectedResult = exports.sleep = void 0;
|
|
4
|
-
const node_net_1 = require("net");
|
|
5
4
|
const node_assert_1 = require("assert");
|
|
5
|
+
const node_net_1 = require("net");
|
|
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', () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getRuntime = void 0;
|
|
4
|
-
const node_process_1 = require("process");
|
|
5
4
|
const node_path_1 = require("path");
|
|
5
|
+
const node_process_1 = require("process");
|
|
6
6
|
const getRuntime = () => {
|
|
7
7
|
const { _, POKU_RUNTIME } = node_process_1.env;
|
|
8
8
|
if (POKU_RUNTIME)
|
package/lib/parsers/options.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getConfigs = void 0;
|
|
4
|
-
const node_path_1 = require("path");
|
|
5
4
|
const promises_1 = require("fs/promises");
|
|
6
|
-
const
|
|
5
|
+
const node_path_1 = require("path");
|
|
7
6
|
const poku_js_1 = require("../configs/poku.js");
|
|
7
|
+
const jsonc_js_1 = require("../polyfills/jsonc.js");
|
|
8
8
|
const os_js_1 = require("./os.js");
|
|
9
9
|
const getConfigs = async (customPath) => {
|
|
10
10
|
const expectedFiles = customPath
|
package/lib/polyfills/deno.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { env, exit, cwd } from 'node:process';
|
|
2
1
|
import { createRequire } from 'node:module';
|
|
3
|
-
import {
|
|
2
|
+
import { normalize, resolve } from 'node:path';
|
|
3
|
+
import { cwd, env, exit } from 'node:process';
|
|
4
4
|
const file = env?.POKU_FILE;
|
|
5
5
|
if (!file)
|
|
6
6
|
exit(1);
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DockerCompose = exports.DockerContainer = void 0;
|
|
4
4
|
const node_child_process_1 = require("child_process");
|
|
5
|
-
const write_js_1 = require("../services/write.js");
|
|
6
|
-
const os_js_1 = require("../parsers/os.js");
|
|
7
5
|
const list_files_js_1 = require("../modules/helpers/list-files.js");
|
|
6
|
+
const os_js_1 = require("../parsers/os.js");
|
|
7
|
+
const write_js_1 = require("../services/write.js");
|
|
8
8
|
const runDockerCommand = (command, args, options, verbose) => new Promise((resolve) => {
|
|
9
9
|
const dockerProcess = (0, node_child_process_1.spawn)(command, args, {
|
|
10
10
|
...options,
|
package/lib/services/each.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.afterEach = exports.beforeEach = void 0;
|
|
4
|
-
const format_js_1 = require("./format.js");
|
|
5
|
-
const write_js_1 = require("../services/write.js");
|
|
6
4
|
const poku_js_1 = require("../configs/poku.js");
|
|
5
|
+
const write_js_1 = require("../services/write.js");
|
|
6
|
+
const format_js_1 = require("./format.js");
|
|
7
7
|
const eachCore = async (type, fileRelative) => {
|
|
8
8
|
const { configs } = poku_js_1.GLOBAL;
|
|
9
9
|
if (typeof configs?.[type] !== 'function')
|
package/lib/services/enforce.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.enforce = void 0;
|
|
4
|
-
const node_process_1 = require("process");
|
|
5
4
|
const promises_1 = require("fs/promises");
|
|
6
|
-
const
|
|
7
|
-
const format_js_1 = require("./format.js");
|
|
5
|
+
const node_process_1 = require("process");
|
|
8
6
|
const poku_js_1 = require("../configs/poku.js");
|
|
9
7
|
const get_arg_js_1 = require("../parsers/get-arg.js");
|
|
8
|
+
const format_js_1 = require("./format.js");
|
|
9
|
+
const write_js_1 = require("./write.js");
|
|
10
10
|
const errors = [];
|
|
11
11
|
const pathExists = async (arg, path) => {
|
|
12
12
|
try {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mapTests = exports.createImportMap = exports.processDeepImports = exports.findMatchingFiles = exports.getDeepImports = exports.normalizePath = void 0;
|
|
4
|
-
const node_path_1 = require("path");
|
|
5
4
|
const promises_1 = require("fs/promises");
|
|
5
|
+
const node_path_1 = require("path");
|
|
6
6
|
const list_files_js_1 = require("../modules/helpers/list-files.js");
|
|
7
7
|
const importMap = new Map();
|
|
8
8
|
const processedFiles = new Set();
|
package/lib/services/reporter.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.reporter = void 0;
|
|
4
|
-
const
|
|
5
|
-
const dot_js_1 = require("./reporters/dot.js");
|
|
4
|
+
const classic_js_1 = require("./reporters/classic.js");
|
|
6
5
|
const compact_js_1 = require("./reporters/compact.js");
|
|
6
|
+
const dot_js_1 = require("./reporters/dot.js");
|
|
7
7
|
const focus_js_1 = require("./reporters/focus.js");
|
|
8
|
+
const poku_js_1 = require("./reporters/poku.js");
|
|
8
9
|
const verbose_js_1 = require("./reporters/verbose.js");
|
|
9
|
-
const classic_js_1 = require("./reporters/classic.js");
|
|
10
10
|
exports.reporter = {
|
|
11
11
|
poku: () => poku_js_1.poku,
|
|
12
12
|
dot: dot_js_1.dot,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.classic = void 0;
|
|
4
|
+
const reporter_js_1 = require("../../builders/reporter.js");
|
|
4
5
|
const indentation_js_1 = require("../../configs/indentation.js");
|
|
5
|
-
const write_js_1 = require("../write.js");
|
|
6
6
|
const format_js_1 = require("../format.js");
|
|
7
|
-
const
|
|
7
|
+
const write_js_1 = require("../write.js");
|
|
8
8
|
const poku_js_1 = require("./poku.js");
|
|
9
9
|
exports.classic = (() => {
|
|
10
10
|
const files = {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.compact = void 0;
|
|
4
|
-
const write_js_1 = require("../write.js");
|
|
5
|
-
const format_js_1 = require("../format.js");
|
|
6
4
|
const reporter_js_1 = require("../../builders/reporter.js");
|
|
7
|
-
const poku_js_1 = require("./poku.js");
|
|
8
5
|
const time_js_1 = require("../../parsers/time.js");
|
|
6
|
+
const format_js_1 = require("../format.js");
|
|
7
|
+
const write_js_1 = require("../write.js");
|
|
8
|
+
const poku_js_1 = require("./poku.js");
|
|
9
9
|
exports.compact = (() => {
|
|
10
10
|
let countFails = 0;
|
|
11
11
|
return (0, reporter_js_1.createReporter)({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dot = void 0;
|
|
4
|
+
const node_process_1 = require("process");
|
|
4
5
|
const reporter_js_1 = require("../../builders/reporter.js");
|
|
5
|
-
const write_js_1 = require("../write.js");
|
|
6
6
|
const format_js_1 = require("../format.js");
|
|
7
|
-
const
|
|
7
|
+
const write_js_1 = require("../write.js");
|
|
8
8
|
const poku_js_1 = require("./poku.js");
|
|
9
9
|
exports.dot = (() => {
|
|
10
10
|
return (0, reporter_js_1.createReporter)({
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.focus = void 0;
|
|
4
4
|
const reporter_js_1 = require("../../builders/reporter.js");
|
|
5
|
-
const write_js_1 = require("../write.js");
|
|
6
|
-
const format_js_1 = require("../format.js");
|
|
7
5
|
const time_js_1 = require("../../parsers/time.js");
|
|
6
|
+
const format_js_1 = require("../format.js");
|
|
7
|
+
const write_js_1 = require("../write.js");
|
|
8
8
|
exports.focus = (() => {
|
|
9
9
|
let countFails = 0;
|
|
10
10
|
return (0, reporter_js_1.createReporter)({
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.poku = exports.errors = void 0;
|
|
4
|
+
const node_path_1 = require("path");
|
|
5
|
+
const node_process_1 = require("process");
|
|
4
6
|
const indentation_js_1 = require("../../configs/indentation.js");
|
|
5
|
-
const time_js_1 = require("../../parsers/time.js");
|
|
6
|
-
const write_js_1 = require("../write.js");
|
|
7
|
-
const format_js_1 = require("../format.js");
|
|
8
7
|
const poku_js_1 = require("../../configs/poku.js");
|
|
9
|
-
const find_file_from_stack_js_1 = require("../../parsers/find-file-from-stack.js");
|
|
10
|
-
const node_path_1 = require("path");
|
|
11
8
|
const assert_js_1 = require("../../parsers/assert.js");
|
|
12
|
-
const
|
|
9
|
+
const find_file_from_stack_js_1 = require("../../parsers/find-file-from-stack.js");
|
|
10
|
+
const time_js_1 = require("../../parsers/time.js");
|
|
11
|
+
const format_js_1 = require("../format.js");
|
|
12
|
+
const write_js_1 = require("../write.js");
|
|
13
13
|
const regexFile = /file:(\/\/)?/;
|
|
14
14
|
exports.errors = [];
|
|
15
15
|
exports.poku = (() => {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.runTestFile = void 0;
|
|
4
|
-
const node_process_1 = require("process");
|
|
5
|
-
const node_path_1 = require("path");
|
|
6
4
|
const node_child_process_1 = require("child_process");
|
|
5
|
+
const node_path_1 = require("path");
|
|
6
|
+
const node_process_1 = require("process");
|
|
7
|
+
const poku_js_1 = require("../configs/poku.js");
|
|
7
8
|
const get_runner_js_1 = require("../parsers/get-runner.js");
|
|
9
|
+
const os_js_1 = require("../parsers/os.js");
|
|
8
10
|
const output_js_1 = require("../parsers/output.js");
|
|
9
11
|
const each_js_1 = require("./each.js");
|
|
10
|
-
const poku_js_1 = require("../configs/poku.js");
|
|
11
|
-
const os_js_1 = require("../parsers/os.js");
|
|
12
12
|
const runTestFile = async (path) => {
|
|
13
13
|
const { cwd, configs, reporter } = poku_js_1.GLOBAL;
|
|
14
14
|
const runtimeOptions = (0, get_runner_js_1.runner)(path);
|
|
@@ -4,15 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.runTests = void 0;
|
|
7
|
-
const node_process_1 = __importDefault(require("process"));
|
|
8
7
|
const node_path_1 = require("path");
|
|
8
|
+
const node_process_1 = __importDefault(require("process"));
|
|
9
|
+
const poku_js_1 = require("../configs/poku.js");
|
|
9
10
|
const list_files_js_1 = require("../modules/helpers/list-files.js");
|
|
11
|
+
const get_arg_js_1 = require("../parsers/get-arg.js");
|
|
12
|
+
const os_js_1 = require("../polyfills/os.js");
|
|
10
13
|
const write_js_1 = require("../services/write.js");
|
|
11
14
|
const format_js_1 = require("./format.js");
|
|
12
15
|
const run_test_file_js_1 = require("./run-test-file.js");
|
|
13
|
-
const poku_js_1 = require("../configs/poku.js");
|
|
14
|
-
const os_js_1 = require("../polyfills/os.js");
|
|
15
|
-
const get_arg_js_1 = require("../parsers/get-arg.js");
|
|
16
16
|
const { cwd } = poku_js_1.GLOBAL;
|
|
17
17
|
if (get_arg_js_1.hasOnly)
|
|
18
18
|
poku_js_1.deepOptions.push('--only');
|
|
@@ -20,7 +20,6 @@ const runTests = async (dir) => {
|
|
|
20
20
|
let allPassed = true;
|
|
21
21
|
let activeTests = 0;
|
|
22
22
|
let resolveDone;
|
|
23
|
-
let rejectDone;
|
|
24
23
|
const { configs } = poku_js_1.GLOBAL;
|
|
25
24
|
const testDir = (0, node_path_1.join)(cwd, dir);
|
|
26
25
|
const files = await (0, list_files_js_1.listFiles)(testDir, configs);
|
|
@@ -32,9 +31,9 @@ const runTests = async (dir) => {
|
|
|
32
31
|
const limit = configs.concurrency ?? Math.max((0, os_js_1.availableParallelism)() - 1, 1);
|
|
33
32
|
return limit <= 0 ? files.length || 1 : limit;
|
|
34
33
|
})();
|
|
35
|
-
const
|
|
34
|
+
const isSequential = concurrency === 1;
|
|
35
|
+
const done = new Promise((resolve) => {
|
|
36
36
|
resolveDone = resolve;
|
|
37
|
-
rejectDone = reject;
|
|
38
37
|
});
|
|
39
38
|
const runNext = async () => {
|
|
40
39
|
if (files.length === 0 && activeTests === 0) {
|
|
@@ -45,31 +44,27 @@ const runTests = async (dir) => {
|
|
|
45
44
|
if (typeof filePath === 'undefined')
|
|
46
45
|
return;
|
|
47
46
|
activeTests++;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
(0, write_js_1.hr)();
|
|
61
|
-
}
|
|
62
|
-
node_process_1.default.exit(1);
|
|
47
|
+
const testPassed = await (0, run_test_file_js_1.runTestFile)(filePath);
|
|
48
|
+
if (testPassed)
|
|
49
|
+
++poku_js_1.results.passed;
|
|
50
|
+
else {
|
|
51
|
+
++poku_js_1.results.failed;
|
|
52
|
+
allPassed = false;
|
|
53
|
+
if (configs.failFast) {
|
|
54
|
+
if (showLogs) {
|
|
55
|
+
(0, write_js_1.hr)();
|
|
56
|
+
console.error(failFastError);
|
|
57
|
+
(0, write_js_1.log)(`\n ${(0, format_js_1.format)('File:').bold()} ${(0, format_js_1.format)(`./${(0, node_path_1.relative)(cwd, filePath)}`).fail()}`);
|
|
58
|
+
(0, write_js_1.hr)();
|
|
63
59
|
}
|
|
60
|
+
node_process_1.default.exit(1);
|
|
64
61
|
}
|
|
65
62
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
runNext().catch(rejectDone);
|
|
63
|
+
activeTests--;
|
|
64
|
+
isSequential ? await runNext() : runNext();
|
|
70
65
|
};
|
|
71
66
|
for (let i = 0; i < concurrency; i++)
|
|
72
|
-
runNext();
|
|
67
|
+
isSequential ? await runNext() : runNext();
|
|
73
68
|
return await done;
|
|
74
69
|
};
|
|
75
70
|
exports.runTests = runTests;
|
package/lib/services/watch.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.watch = exports.Watcher = void 0;
|
|
4
4
|
const node_fs_1 = require("fs");
|
|
5
|
-
const node_path_1 = require("path");
|
|
6
5
|
const promises_1 = require("fs/promises");
|
|
6
|
+
const node_path_1 = require("path");
|
|
7
7
|
const list_files_js_1 = require("../modules/helpers/list-files.js");
|
|
8
8
|
class Watcher {
|
|
9
9
|
constructor(rootDir, callback) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poku",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1-canary.d486f01",
|
|
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",
|
|
@@ -51,10 +51,11 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@biomejs/biome": "1.9.4",
|
|
54
|
-
"@
|
|
54
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.4.1",
|
|
55
|
+
"@types/node": "^22.13.1",
|
|
55
56
|
"c8": "^10.1.3",
|
|
56
57
|
"jsonc.min": "^1.1.0",
|
|
57
|
-
"monocart-coverage-reports": "^2.12.
|
|
58
|
+
"monocart-coverage-reports": "^2.12.1",
|
|
58
59
|
"packages-update": "^2.0.0",
|
|
59
60
|
"prettier": "^3.4.2",
|
|
60
61
|
"tsx": "4.19.2",
|