poku 2.4.3 → 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.
- package/lib/bin/enforce.js +53 -0
- package/lib/bin/index.js +16 -11
- package/lib/bin/watch.js +2 -2
- package/lib/builders/assert.d.ts +2 -2
- package/lib/configs/poku.js +1 -1
- package/lib/modules/essentials/assert.d.ts +1 -1
- package/lib/modules/helpers/create-service.js +2 -0
- package/lib/modules/helpers/env.js +3 -2
- package/lib/modules/helpers/wait-for.js +1 -1
- package/lib/parsers/get-arg.js +6 -4
- package/lib/parsers/options.js +1 -1
- package/lib/parsers/to-dynamic-case.d.ts +1 -0
- package/lib/parsers/to-dynamic-case.js +18 -0
- package/lib/polyfills/fs.d.ts +1 -1
- package/lib/services/container.js +2 -0
- package/lib/services/format.js +2 -1
- package/lib/services/map-tests.js +2 -2
- package/lib/services/run-test-file.js +2 -0
- package/lib/services/run-tests.js +11 -6
- package/package.json +8 -13
|
@@ -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)('
|
|
38
|
-
const killRange = (0, get_arg_js_1.getArg)('
|
|
39
|
-
const killPID = (0, get_arg_js_1.getArg)('
|
|
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)('
|
|
42
|
-
const denoDeny = (_e = (0, get_arg_js_1.argToArray)('
|
|
43
|
-
const denoCJS = ((_g = (0, get_arg_js_1.getArg)('
|
|
44
|
-
(0, get_arg_js_1.hasArg)('
|
|
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)('
|
|
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)('
|
|
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)('
|
|
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)('
|
|
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)('
|
|
20
|
+
const interval = Number((0, get_arg_js_1.getArg)('watchinterval')) || 1500;
|
|
21
21
|
const setIsRunning = (value) => {
|
|
22
22
|
isRunning = value;
|
|
23
23
|
};
|
|
@@ -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('
|
|
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;
|
package/lib/builders/assert.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ProcessAssertionOptions } from '../@types/assert.js';
|
|
2
|
-
import type assert from
|
|
3
|
-
import type { AssertPredicate } from
|
|
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;
|
package/lib/configs/poku.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import nodeAssert from
|
|
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,
|
|
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
|
-
|
|
27
|
+
node_process_1.env[arg] = value;
|
|
27
28
|
}
|
|
28
29
|
};
|
|
29
30
|
exports.envFile = envFile;
|
|
@@ -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.
|
|
9
|
+
client.end();
|
|
10
10
|
resolve(true);
|
|
11
11
|
});
|
|
12
12
|
client.on('error', () => {
|
package/lib/parsers/get-arg.js
CHANGED
|
@@ -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
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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;
|
package/lib/parsers/options.js
CHANGED
|
@@ -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, '
|
|
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) { }
|
|
@@ -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;
|
package/lib/polyfills/fs.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { stat as nodeStat, readdir as nodeReaddir, readFile as nodeReadFile } from
|
|
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__;
|
|
@@ -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
|
}
|
package/lib/services/format.js
CHANGED
|
@@ -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, '
|
|
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, '
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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,9 +52,10 @@ 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
|
-
write_js_1.Write.log(` ${(0, format_js_1.format)('ℹ').fail()} ${(0, format_js_1.format)('
|
|
58
|
+
write_js_1.Write.log(` ${(0, format_js_1.format)('ℹ').fail()} ${(0, format_js_1.format)('failFast').bold()} is enabled`);
|
|
55
59
|
}
|
|
56
60
|
break;
|
|
57
61
|
}
|
|
@@ -83,7 +87,8 @@ 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) {
|
|
86
|
-
|
|
90
|
+
node_process_1.default.exitCode = 1;
|
|
91
|
+
throw new Error(` ${(0, format_js_1.format)('ℹ').fail()} ${(0, format_js_1.format)('failFast').bold()} is enabled`);
|
|
87
92
|
}
|
|
88
93
|
return false;
|
|
89
94
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poku",
|
|
3
|
-
"version": "2.
|
|
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,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 --
|
|
41
|
-
"test:deno:parallel": "tsx src/bin/index.ts --deno --
|
|
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",
|
|
45
|
-
"test:
|
|
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 &&
|
|
54
|
-
"postbuild": "tsx tools/compatibility/node.ts && tsx tools/compatibility/comments.ts && tsx tools/build/version.ts && cp
|
|
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,10 +57,10 @@
|
|
|
62
57
|
},
|
|
63
58
|
"devDependencies": {
|
|
64
59
|
"@biomejs/biome": "1.8.3",
|
|
65
|
-
"@types/node": "^22.1
|
|
60
|
+
"@types/node": "^22.4.1",
|
|
66
61
|
"c8": "^10.1.2",
|
|
67
62
|
"jsonc.min": "^1.0.0",
|
|
68
|
-
"monocart-coverage-reports": "^2.10.
|
|
63
|
+
"monocart-coverage-reports": "^2.10.3",
|
|
69
64
|
"packages-update": "^2.0.0",
|
|
70
65
|
"prettier": "^3.3.3",
|
|
71
66
|
"tsx": "4.17.0",
|