poku 2.2.3 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/@types/poku.d.ts +3 -0
- package/lib/bin/index.js +4 -1
- package/lib/configs/files.d.ts +2 -1
- package/lib/configs/files.js +2 -1
- package/lib/modules/essentials/assert.js +0 -2
- package/lib/modules/essentials/poku.js +6 -16
- package/lib/modules/essentials/strict.js +0 -2
- package/lib/modules/helpers/container.js +0 -1
- package/lib/modules/helpers/describe.d.ts +0 -1
- package/lib/modules/helpers/describe.js +1 -2
- package/lib/modules/helpers/each.d.ts +2 -2
- package/lib/modules/helpers/each.js +2 -3
- package/lib/modules/helpers/env.js +0 -2
- package/lib/modules/helpers/exit.js +2 -0
- package/lib/modules/helpers/it.js +1 -3
- package/lib/modules/helpers/list-files.js +13 -4
- package/lib/modules/helpers/test.js +0 -2
- package/lib/modules/helpers/wait-for.js +0 -4
- package/lib/parsers/assert.js +2 -4
- package/lib/parsers/find-file-from-stack.js +0 -2
- package/lib/parsers/get-arg.js +0 -2
- package/lib/parsers/get-runner.js +1 -1
- package/lib/parsers/options.js +0 -1
- package/lib/parsers/output.js +0 -1
- package/lib/parsers/time.js +0 -2
- package/lib/polyfills/cpus.js +2 -2
- package/lib/polyfills/object.js +1 -1
- package/lib/services/assert.js +3 -6
- package/lib/services/container.js +3 -3
- package/lib/services/each.js +0 -1
- package/lib/services/env.js +0 -3
- package/lib/services/format.d.ts +1 -0
- package/lib/services/format.js +18 -3
- package/lib/services/map-tests.js +0 -2
- package/lib/services/run-test-file.js +2 -5
- package/lib/services/run-tests.js +4 -16
- package/lib/services/watch.js +0 -11
- package/lib/services/write.js +0 -1
- package/package.json +7 -3
- package/lib/@types/assert.js +0 -2
- package/lib/@types/background-process.js +0 -2
- package/lib/@types/code.js +0 -2
- package/lib/@types/container.js +0 -2
- package/lib/@types/describe.js +0 -2
- package/lib/@types/each.js +0 -2
- package/lib/@types/list-files.js +0 -2
- package/lib/@types/poku.js +0 -2
- package/lib/@types/runner.js +0 -2
- package/lib/@types/wait-for.js +0 -2
- package/lib/@types/watch.js +0 -2
- package/lib/bin/index.d.ts +0 -2
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Enjoying **Poku**? Give him a star to show your support 🌟
|
|
|
7
7
|
|
|
8
8
|
[](https://www.npmjs.com/package/poku)
|
|
9
9
|
[](https://www.npmjs.com/package/poku)
|
|
10
|
-
[](https://
|
|
10
|
+
[](https://github.com/wellwelwel/poku/tree/main/.nycrc)<br />
|
|
11
11
|
[](https://github.com/wellwelwel/poku/actions/workflows/ci_coverage-linux.yml?query=branch%3Amain)
|
|
12
12
|
[](https://github.com/wellwelwel/poku/actions/workflows/ci_coverage-osx.yml?query=branch%3Amain)
|
|
13
13
|
[](https://github.com/wellwelwel/poku/actions/workflows/ci_coverage-windows.yml?query=branch%3Amain)
|
package/lib/@types/poku.d.ts
CHANGED
|
@@ -83,6 +83,9 @@ export type FinalResults = {
|
|
|
83
83
|
time: string;
|
|
84
84
|
started: Date;
|
|
85
85
|
};
|
|
86
|
+
export type States = {
|
|
87
|
+
isSinglePath?: boolean;
|
|
88
|
+
};
|
|
86
89
|
type cliConfigs = {
|
|
87
90
|
/** By default, **Poku** searches for _`.test.`_ and `.spec.` files, but you can customize it. */
|
|
88
91
|
include?: string | string[];
|
package/lib/bin/index.js
CHANGED
|
@@ -23,7 +23,7 @@ const options_js_1 = require("../parsers/options.js");
|
|
|
23
23
|
const defaultConfigs = await (0, options_js_1.getConfigs)(configFile);
|
|
24
24
|
const dirs = (() => {
|
|
25
25
|
var _a;
|
|
26
|
-
const includeArg = (0, get_arg_js_1.getArg)('include');
|
|
26
|
+
const includeArg = (0, get_arg_js_1.getArg)('include');
|
|
27
27
|
if (includeArg !== undefined) {
|
|
28
28
|
return includeArg.split(',');
|
|
29
29
|
}
|
|
@@ -55,6 +55,9 @@ const options_js_1 = require("../parsers/options.js");
|
|
|
55
55
|
const value = Number((0, get_arg_js_1.getArg)('concurrency'));
|
|
56
56
|
return Number.isNaN(value) ? defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.concurrency : value;
|
|
57
57
|
})();
|
|
58
|
+
if (dirs.length === 1) {
|
|
59
|
+
files_js_1.states.isSinglePath = true;
|
|
60
|
+
}
|
|
58
61
|
const tasks = [];
|
|
59
62
|
if (killPort || ((_j = defaultConfigs === null || defaultConfigs === void 0 ? void 0 : defaultConfigs.kill) === null || _j === void 0 ? void 0 : _j.port)) {
|
|
60
63
|
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) || [];
|
package/lib/configs/files.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FileResults } from '../@types/list-files.js';
|
|
2
|
-
import type { FinalResults } from '../@types/poku.js';
|
|
2
|
+
import type { FinalResults, States } from '../@types/poku.js';
|
|
3
|
+
export declare const states: States;
|
|
3
4
|
export declare const fileResults: FileResults;
|
|
4
5
|
export declare const finalResults: FinalResults;
|
package/lib/configs/files.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.finalResults = exports.fileResults = void 0;
|
|
3
|
+
exports.finalResults = exports.fileResults = exports.states = void 0;
|
|
4
|
+
exports.states = {};
|
|
4
5
|
exports.fileResults = {
|
|
5
6
|
success: new Map(),
|
|
6
7
|
fail: new Map(),
|
|
@@ -4,8 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.assert = void 0;
|
|
7
|
-
/* c8 ignore next */ // ?
|
|
8
7
|
const node_assert_1 = __importDefault(require("assert"));
|
|
9
8
|
const assert_js_1 = require("../../services/assert.js");
|
|
10
|
-
/* c8 ignore next */ // ?
|
|
11
9
|
exports.assert = (0, assert_js_1.createAssert)(node_assert_1.default);
|
|
@@ -12,13 +12,12 @@ const exit_js_1 = require("../helpers/exit.js");
|
|
|
12
12
|
const format_js_1 = require("../../services/format.js");
|
|
13
13
|
const output_js_1 = require("../../parsers/output.js");
|
|
14
14
|
const files_js_1 = require("../../configs/files.js");
|
|
15
|
-
|
|
16
|
-
/* c8 ignore next 3 */
|
|
15
|
+
|
|
17
16
|
const onSigint = () => {
|
|
18
17
|
node_process_1.default.stdout.write('\u001B[?25h');
|
|
19
18
|
};
|
|
20
19
|
exports.onSigint = onSigint;
|
|
21
|
-
|
|
20
|
+
|
|
22
21
|
node_process_1.default.once('SIGINT', exports.onSigint);
|
|
23
22
|
async function poku(targetPaths, configs) {
|
|
24
23
|
let code = 0;
|
|
@@ -27,7 +26,7 @@ async function poku(targetPaths, configs) {
|
|
|
27
26
|
const prepareDirs = Array.prototype.concat(targetPaths);
|
|
28
27
|
const dirs = prepareDirs.length > 0 ? prepareDirs : ['.'];
|
|
29
28
|
const showLogs = !(0, output_js_1.isQuiet)(configs);
|
|
30
|
-
|
|
29
|
+
|
|
31
30
|
if (!(configs === null || configs === void 0 ? void 0 : configs.parallel)) {
|
|
32
31
|
for (const dir of dirs) {
|
|
33
32
|
const result = await (0, run_tests_js_1.runTests)(dir, configs);
|
|
@@ -44,10 +43,11 @@ async function poku(targetPaths, configs) {
|
|
|
44
43
|
const end = node_process_1.default.hrtime(start);
|
|
45
44
|
const total = (end[0] * 1e3 + end[1] / 1e6).toFixed(6);
|
|
46
45
|
files_js_1.finalResults.time = total;
|
|
46
|
+
showLogs && (0, format_js_1.showTestResults)();
|
|
47
47
|
(0, exit_js_1.exit)(code, configs === null || configs === void 0 ? void 0 : configs.quiet);
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
if (showLogs) {
|
|
52
52
|
write_js_1.Write.hr();
|
|
53
53
|
write_js_1.Write.log(`${(0, format_js_1.format)('Running the Test Suite in Parallel').bold()}\n`);
|
|
@@ -72,17 +72,7 @@ async function poku(targetPaths, configs) {
|
|
|
72
72
|
const total = (end[0] * 1e3 + end[1] / 1e6).toFixed(6);
|
|
73
73
|
files_js_1.finalResults.time = total;
|
|
74
74
|
}
|
|
75
|
-
showLogs &&
|
|
76
|
-
if (showLogs && files_js_1.fileResults.success.size > 0) {
|
|
77
|
-
write_js_1.Write.log(Array.from(files_js_1.fileResults.success)
|
|
78
|
-
.map(([file, time]) => `${indentation_js_1.indentation.test}${(0, format_js_1.format)('✔').success()} ${(0, format_js_1.format)(`${file} ${(0, format_js_1.format)(`› ${time}ms`).success()}`).dim()}`)
|
|
79
|
-
.join('\n'));
|
|
80
|
-
}
|
|
81
|
-
if (showLogs && files_js_1.fileResults.fail.size > 0) {
|
|
82
|
-
write_js_1.Write.log(Array.from(files_js_1.fileResults.fail)
|
|
83
|
-
.map(([file, time]) => `${indentation_js_1.indentation.test}${(0, format_js_1.format)('✘').fail()} ${(0, format_js_1.format)(`${file} ${(0, format_js_1.format)(`› ${time}ms`).fail()}`).dim()}`)
|
|
84
|
-
.join('\n'));
|
|
85
|
-
}
|
|
75
|
+
showLogs && (0, format_js_1.showTestResults)();
|
|
86
76
|
if (configs === null || configs === void 0 ? void 0 : configs.noExit) {
|
|
87
77
|
return code;
|
|
88
78
|
}
|
|
@@ -4,8 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.strict = void 0;
|
|
7
|
-
/* c8 ignore next */ // ?
|
|
8
7
|
const strict_1 = __importDefault(require("assert/strict"));
|
|
9
8
|
const assert_js_1 = require("../../services/assert.js");
|
|
10
|
-
/* c8 ignore next */ // ?
|
|
11
9
|
exports.strict = (0, assert_js_1.createAssert)(strict_1.default);
|
|
@@ -6,5 +6,4 @@ const container_js_1 = require("../../services/container.js");
|
|
|
6
6
|
const dockerfile = (configs) => new container_js_1.DockerContainer(configs);
|
|
7
7
|
/** A minimal API to assist tests that require containers or tests that run inside containers using a **docker-compose.yml**. */
|
|
8
8
|
const compose = (configs) => new container_js_1.DockerCompose(configs);
|
|
9
|
-
/* c8 ignore next */ // ?
|
|
10
9
|
exports.docker = { dockerfile, compose };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { DescribeOptions } from '../../@types/describe.js';
|
|
2
|
-
/** On **Poku**, `describe` also can be used just as a pretty `console.log` to title your test suites in the terminal */
|
|
3
2
|
export declare function describe(title: string, cb: () => Promise<unknown>): Promise<void>;
|
|
4
3
|
export declare function describe(title: string, cb: () => unknown): void;
|
|
5
4
|
export declare function describe(cb: () => Promise<unknown>): Promise<void>;
|
|
@@ -5,7 +5,6 @@ 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
|
-
/* c8 ignore next */ // ?
|
|
9
8
|
async function describe(arg1, arg2) {
|
|
10
9
|
let title;
|
|
11
10
|
let cb;
|
|
@@ -28,7 +27,7 @@ async function describe(arg1, arg2) {
|
|
|
28
27
|
if (title) {
|
|
29
28
|
indentation_js_1.indentation.hasDescribe = true;
|
|
30
29
|
const { background, icon } = options || {};
|
|
31
|
-
const message = `${cb ? (0, format_js_1.format)('◌').dim() : icon || '☰'} ${cb ? (0, format_js_1.format)(isPoku ? `${title} › ${(0, format_js_1.format)(`${FILE}`).italic().gray()}` : title).dim() : (0, format_js_1.format)(title).bold()
|
|
30
|
+
const message = `${cb ? (0, format_js_1.format)('◌').dim() : icon || '☰'} ${cb ? (0, format_js_1.format)(isPoku ? `${title} › ${(0, format_js_1.format)(`${FILE}`).italic().gray()}` : title).dim() : (0, format_js_1.format)(title).bold()}`;
|
|
32
31
|
const noBackground = !background;
|
|
33
32
|
if (noBackground) {
|
|
34
33
|
write_js_1.Write.log((0, format_js_1.format)(message).bold());
|
|
@@ -8,7 +8,7 @@ import type { Control, EachOptions } from '../../@types/each.js';
|
|
|
8
8
|
* import { beforeEach } from 'poku';
|
|
9
9
|
*
|
|
10
10
|
* const before = beforeEach(() => {
|
|
11
|
-
*
|
|
11
|
+
*
|
|
12
12
|
* };
|
|
13
13
|
*
|
|
14
14
|
* before.pause();
|
|
@@ -26,7 +26,7 @@ export declare const beforeEach: (callback: () => unknown, options?: EachOptions
|
|
|
26
26
|
* import { afterEach } from 'poku';
|
|
27
27
|
*
|
|
28
28
|
* const after = afterEach(() => {
|
|
29
|
-
*
|
|
29
|
+
*
|
|
30
30
|
* };
|
|
31
31
|
*
|
|
32
32
|
* after.pause();
|
|
@@ -11,7 +11,7 @@ const each_js_1 = require("../../configs/each.js");
|
|
|
11
11
|
* import { beforeEach } from 'poku';
|
|
12
12
|
*
|
|
13
13
|
* const before = beforeEach(() => {
|
|
14
|
-
*
|
|
14
|
+
*
|
|
15
15
|
* };
|
|
16
16
|
*
|
|
17
17
|
* before.pause();
|
|
@@ -47,7 +47,7 @@ exports.beforeEach = beforeEach;
|
|
|
47
47
|
* import { afterEach } from 'poku';
|
|
48
48
|
*
|
|
49
49
|
* const after = afterEach(() => {
|
|
50
|
-
*
|
|
50
|
+
*
|
|
51
51
|
* };
|
|
52
52
|
*
|
|
53
53
|
* after.pause();
|
|
@@ -55,7 +55,6 @@ exports.beforeEach = beforeEach;
|
|
|
55
55
|
* after.reset();
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
|
-
/* c8 ignore next */ // ?
|
|
59
58
|
const afterEach = (callback) => {
|
|
60
59
|
each_js_1.each.after.cb = () => {
|
|
61
60
|
if (each_js_1.each.after.status) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.envFile = void 0;
|
|
4
|
-
/* c8 ignore start */ // ?
|
|
5
4
|
const fs_js_1 = require("../../polyfills/fs.js");
|
|
6
5
|
const list_files_js_1 = require("./list-files.js");
|
|
7
6
|
const env_js_1 = require("../../services/env.js");
|
|
@@ -10,7 +9,6 @@ const regex = {
|
|
|
10
9
|
};
|
|
11
10
|
/** Reads an environment file and sets the environment variables. */
|
|
12
11
|
const envFile = async (filePath = '.env') => {
|
|
13
|
-
/* c8 ignore stop */
|
|
14
12
|
const mapEnv = new Map();
|
|
15
13
|
const env = await (0, fs_js_1.readFile)((0, list_files_js_1.sanitizePath)(filePath), 'utf8');
|
|
16
14
|
const lines = env
|
|
@@ -28,10 +28,12 @@ const exit = (code, quiet) => {
|
|
|
28
28
|
node_process_1.default.exit(code === 0 ? 0 : 1);
|
|
29
29
|
};
|
|
30
30
|
exports.exit = exit;
|
|
31
|
+
|
|
31
32
|
node_process_1.default.on('unhandledRejection', (reason) => {
|
|
32
33
|
console.error('unhandledRejection', reason);
|
|
33
34
|
node_process_1.default.exit(1);
|
|
34
35
|
});
|
|
36
|
+
|
|
35
37
|
node_process_1.default.on('uncaughtException', (err) => {
|
|
36
38
|
console.error('uncaughtException', err);
|
|
37
39
|
node_process_1.default.exit(1);
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.it = it;
|
|
4
|
-
/* c8 ignore next */ // ?
|
|
5
4
|
const node_process_1 = require("process");
|
|
6
5
|
const each_js_1 = require("../../configs/each.js");
|
|
7
6
|
const indentation_js_1 = require("../../configs/indentation.js");
|
|
8
7
|
const format_js_1 = require("../../services/format.js");
|
|
9
8
|
const write_js_1 = require("../../services/write.js");
|
|
10
|
-
/* c8 ignore next */ // ?
|
|
11
9
|
async function it(...args) {
|
|
12
10
|
try {
|
|
13
11
|
let message;
|
|
@@ -23,7 +21,7 @@ async function it(...args) {
|
|
|
23
21
|
}
|
|
24
22
|
if (message) {
|
|
25
23
|
indentation_js_1.indentation.hasItOrTest = true;
|
|
26
|
-
write_js_1.Write.log(isPoku
|
|
24
|
+
write_js_1.Write.log(isPoku
|
|
27
25
|
? `${indentation_js_1.indentation.hasDescribe ? ' ' : ''}${(0, format_js_1.format)(`◌ ${message} › ${(0, format_js_1.format)(`${FILE}`).italic().gray()}`).dim()}`
|
|
28
26
|
: `${indentation_js_1.indentation.hasDescribe ? ' ' : ''}${(0, format_js_1.format)(`◌ ${message}`).dim()}`);
|
|
29
27
|
}
|
|
@@ -5,6 +5,7 @@ exports.listFiles = exports.getAllFiles = exports.escapeRegExp = exports.isFile
|
|
|
5
5
|
const node_process_1 = require("process");
|
|
6
6
|
const node_path_1 = require("path");
|
|
7
7
|
const fs_js_1 = require("../../polyfills/fs.js");
|
|
8
|
+
const files_js_1 = require("../../configs/files.js");
|
|
8
9
|
const regex = {
|
|
9
10
|
sep: /[/\\]+/g,
|
|
10
11
|
pathLevel: /(\.\.(\/|\\|$))+/g,
|
|
@@ -31,7 +32,14 @@ const envFilter = ((_a = node_process_1.env.FILTER) === null || _a === void 0 ?
|
|
|
31
32
|
? new RegExp((0, exports.escapeRegExp)(node_process_1.env.FILTER), 'i')
|
|
32
33
|
: undefined;
|
|
33
34
|
const getAllFiles = async (dirPath, files = new Set(), configs) => {
|
|
34
|
-
|
|
35
|
+
let isFullPath = false;
|
|
36
|
+
const currentFiles = await (async () => {
|
|
37
|
+
if (await (0, exports.isFile)(dirPath)) {
|
|
38
|
+
isFullPath = true;
|
|
39
|
+
return Array.prototype.concat((0, exports.sanitizePath)(dirPath));
|
|
40
|
+
}
|
|
41
|
+
return await (0, fs_js_1.readdir)((0, exports.sanitizePath)(dirPath));
|
|
42
|
+
})();
|
|
35
43
|
const filter = envFilter
|
|
36
44
|
? envFilter
|
|
37
45
|
: (configs === null || configs === void 0 ? void 0 : configs.filter) instanceof RegExp
|
|
@@ -43,13 +51,15 @@ const getAllFiles = async (dirPath, files = new Set(), configs) => {
|
|
|
43
51
|
: [configs.exclude]
|
|
44
52
|
: undefined;
|
|
45
53
|
await Promise.all(currentFiles.map(async (file) => {
|
|
46
|
-
const fullPath = (0, node_path_1.join)(dirPath, file);
|
|
54
|
+
const fullPath = isFullPath ? dirPath : (0, node_path_1.join)(dirPath, file);
|
|
47
55
|
const stat = await (0, fs_js_1.stat)(fullPath);
|
|
48
|
-
/* c8 ignore next 6 */
|
|
49
56
|
if (fullPath.indexOf('node_modules') !== -1 ||
|
|
50
57
|
fullPath.indexOf('.git') === 0) {
|
|
51
58
|
return;
|
|
52
59
|
}
|
|
60
|
+
if (isFullPath && (files_js_1.states === null || files_js_1.states === void 0 ? void 0 : files_js_1.states.isSinglePath)) {
|
|
61
|
+
return files.add(fullPath);
|
|
62
|
+
}
|
|
53
63
|
if (exclude) {
|
|
54
64
|
for (const pattern of exclude) {
|
|
55
65
|
if (pattern.test(fullPath)) {
|
|
@@ -67,6 +77,5 @@ const getAllFiles = async (dirPath, files = new Set(), configs) => {
|
|
|
67
77
|
return files;
|
|
68
78
|
};
|
|
69
79
|
exports.getAllFiles = getAllFiles;
|
|
70
|
-
/* c8 ignore next */ // ?
|
|
71
80
|
const listFiles = async (targetDir, configs) => Array.from(await (0, exports.getAllFiles)((0, exports.sanitizePath)(targetDir), new Set(), configs));
|
|
72
81
|
exports.listFiles = listFiles;
|
|
@@ -15,7 +15,6 @@ const checkPort = (port, host) => new Promise((resolve) => {
|
|
|
15
15
|
});
|
|
16
16
|
/** Wait until the defined milliseconds. */
|
|
17
17
|
const sleep = (milliseconds) => {
|
|
18
|
-
/* c8 ignore next 3 */
|
|
19
18
|
if (!Number.isInteger(milliseconds)) {
|
|
20
19
|
throw new Error('Milliseconds must be an integer.');
|
|
21
20
|
}
|
|
@@ -27,7 +26,6 @@ const waitForExpectedResult = async (callback, expectedResult, options) => {
|
|
|
27
26
|
const delay = (options === null || options === void 0 ? void 0 : options.delay) || 0;
|
|
28
27
|
const interval = (options === null || options === void 0 ? void 0 : options.interval) || 100;
|
|
29
28
|
const timeout = (options === null || options === void 0 ? void 0 : options.timeout) || 60000;
|
|
30
|
-
/* c8 ignore start */
|
|
31
29
|
if (typeof callback !== 'function') {
|
|
32
30
|
throw new Error('Callback must be a function.');
|
|
33
31
|
}
|
|
@@ -40,7 +38,6 @@ const waitForExpectedResult = async (callback, expectedResult, options) => {
|
|
|
40
38
|
if (!Number.isInteger(delay)) {
|
|
41
39
|
throw new Error('Delay must be an integer.');
|
|
42
40
|
}
|
|
43
|
-
/* c8 ignore stop */
|
|
44
41
|
await (0, exports.sleep)(delay);
|
|
45
42
|
const startTime = Date.now();
|
|
46
43
|
while (true) {
|
|
@@ -73,7 +70,6 @@ const waitForExpectedResult = async (callback, expectedResult, options) => {
|
|
|
73
70
|
await (0, exports.sleep)(delay);
|
|
74
71
|
};
|
|
75
72
|
exports.waitForExpectedResult = waitForExpectedResult;
|
|
76
|
-
/* c8 ignore next 2 */ // ?
|
|
77
73
|
/** Wait until the defined port is active. */
|
|
78
74
|
const waitForPort = async (port, options) => {
|
|
79
75
|
const host = (options === null || options === void 0 ? void 0 : options.host) || 'localhost';
|
package/lib/parsers/assert.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseResultType = void 0;
|
|
4
|
-
/* c8 ignore next */ // ?
|
|
5
4
|
const object_js_1 = require("../polyfills/object.js");
|
|
6
5
|
const get_runtime_js_1 = require("./get-runtime.js");
|
|
7
|
-
/* c8 ignore next */ // ?
|
|
8
6
|
const parseResultType = (type) => {
|
|
9
7
|
const recurse = (value) => {
|
|
10
8
|
if (typeof value === 'undefined' ||
|
|
@@ -20,7 +18,7 @@ const parseResultType = (type) => {
|
|
|
20
18
|
if (value instanceof Set) {
|
|
21
19
|
return Array.from(value).map(recurse);
|
|
22
20
|
}
|
|
23
|
-
|
|
21
|
+
|
|
24
22
|
if (value instanceof Map) {
|
|
25
23
|
return recurse(!get_runtime_js_1.nodeVersion || get_runtime_js_1.nodeVersion >= 12
|
|
26
24
|
? Object.fromEntries(value)
|
|
@@ -32,7 +30,7 @@ const parseResultType = (type) => {
|
|
|
32
30
|
}
|
|
33
31
|
return (0, object_js_1.fromEntries)((0, object_js_1.entries)(value).map(([key, val]) => [key, recurse(val)]));
|
|
34
32
|
}
|
|
35
|
-
|
|
33
|
+
|
|
36
34
|
return value;
|
|
37
35
|
};
|
|
38
36
|
const result = recurse(type);
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findFile = void 0;
|
|
4
|
-
/* c8 ignore next */ // ?
|
|
5
4
|
const regex = /at\s(\/.+|file:.+)|^(\s+)at\smodule\scode\s\((\/.+|file:.+)\)/i;
|
|
6
|
-
/* c8 ignore next */ // ?
|
|
7
5
|
const findFile = (error) => {
|
|
8
6
|
var _a;
|
|
9
7
|
const stackLines = ((_a = error.stack) === null || _a === void 0 ? void 0 : _a.split('\n')) || [];
|
package/lib/parsers/get-arg.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.argToArray = exports.getPaths = exports.hasArg = exports.getArg = void 0;
|
|
4
|
-
/* c8 ignore next */ // ?
|
|
5
4
|
const node_process_1 = require("process");
|
|
6
5
|
const [, , ...processArgs] = node_process_1.argv;
|
|
7
6
|
const regexQuotes = /''|""/;
|
|
@@ -34,7 +33,6 @@ const getPaths = (prefix = '--', baseArgs = processArgs) => {
|
|
|
34
33
|
return hasPaths ? paths : undefined;
|
|
35
34
|
};
|
|
36
35
|
exports.getPaths = getPaths;
|
|
37
|
-
/* c8 ignore next */ // ?
|
|
38
36
|
const argToArray = (arg, prefix = '--', baseArgs = processArgs) => {
|
|
39
37
|
const hasArgument = (0, exports.hasArg)(arg, prefix, baseArgs);
|
|
40
38
|
if (!hasArgument) {
|
|
@@ -30,7 +30,7 @@ const runner = (filename, configs) => {
|
|
|
30
30
|
: [];
|
|
31
31
|
return ['deno', 'run', ...denoAllow, ...denoDeny];
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
return ['.ts', '.mts', '.cts'].includes((0, node_path_1.extname)(filename))
|
|
35
35
|
? [exports.isWindows ? 'npx.cmd' : 'npx', 'tsx']
|
|
36
36
|
: ['node'];
|
package/lib/parsers/options.js
CHANGED
|
@@ -6,7 +6,6 @@ const node_path_1 = require("path");
|
|
|
6
6
|
const fs_js_1 = require("../polyfills/fs.js");
|
|
7
7
|
const jsonc_js_1 = require("../polyfills/jsonc.js");
|
|
8
8
|
const processCWD = (0, node_process_1.cwd)();
|
|
9
|
-
/* c8 ignore next */ // ?
|
|
10
9
|
const getConfigs = async (customPath) => {
|
|
11
10
|
const expectedFiles = customPath
|
|
12
11
|
? [customPath]
|
package/lib/parsers/output.js
CHANGED
|
@@ -11,7 +11,6 @@ const isQuiet = (configs) => typeof (configs === null || configs === void 0 ? vo
|
|
|
11
11
|
exports.isQuiet = isQuiet;
|
|
12
12
|
const isDebug = (configs) => Boolean(configs === null || configs === void 0 ? void 0 : configs.debug);
|
|
13
13
|
exports.isDebug = isDebug;
|
|
14
|
-
/* c8 ignore next */ // ?
|
|
15
14
|
const parserOutput = (options) => {
|
|
16
15
|
const { output, result, configs } = options;
|
|
17
16
|
const normalizedOutput = JSON.stringify(output);
|
package/lib/parsers/time.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseTimeToSecs = exports.parseTime = void 0;
|
|
4
|
-
/* c8 ignore next */ // ?
|
|
5
4
|
const parseTime = (date) => {
|
|
6
5
|
const hours = date.getHours().toString().padStart(2, '0');
|
|
7
6
|
const minutes = date.getMinutes().toString().padStart(2, '0');
|
|
@@ -9,7 +8,6 @@ const parseTime = (date) => {
|
|
|
9
8
|
return `${hours}:${minutes}:${seconds}`;
|
|
10
9
|
};
|
|
11
10
|
exports.parseTime = parseTime;
|
|
12
|
-
/* c8 ignore next */ // ?
|
|
13
11
|
const parseTimeToSecs = (milliseconds) => {
|
|
14
12
|
const ms = Number.parseFloat(milliseconds);
|
|
15
13
|
const seconds = (ms / 1000).toFixed(2);
|
package/lib/polyfills/cpus.js
CHANGED
|
@@ -5,7 +5,7 @@ const node_os_1 = require("os");
|
|
|
5
5
|
const availableParallelism = () => {
|
|
6
6
|
var _a, _b;
|
|
7
7
|
return typeof node_os_1.availableParallelism === 'function'
|
|
8
|
-
?
|
|
9
|
-
: ((_b = (_a = (0, node_os_1.cpus)()) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b :
|
|
8
|
+
? (0, node_os_1.availableParallelism)()
|
|
9
|
+
: ((_b = (_a = (0, node_os_1.cpus)()) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0);
|
|
10
10
|
};
|
|
11
11
|
exports.availableParallelism = availableParallelism;
|
package/lib/polyfills/object.js
CHANGED
package/lib/services/assert.js
CHANGED
|
@@ -36,7 +36,6 @@ const processAssert = async (cb, options) => {
|
|
|
36
36
|
: `${preIdentation}${(0, format_js_1.format)(`✔ ${options.message}`).success().bold()}`;
|
|
37
37
|
write_js_1.Write.log(message);
|
|
38
38
|
}
|
|
39
|
-
/* c8 ignore start */
|
|
40
39
|
}
|
|
41
40
|
catch (error) {
|
|
42
41
|
if (error instanceof node_assert_1.AssertionError) {
|
|
@@ -81,12 +80,11 @@ const processAssert = async (cb, options) => {
|
|
|
81
80
|
}
|
|
82
81
|
(0, node_process_1.exit)(1);
|
|
83
82
|
}
|
|
84
|
-
|
|
83
|
+
|
|
85
84
|
throw error;
|
|
86
85
|
}
|
|
87
86
|
};
|
|
88
87
|
exports.processAssert = processAssert;
|
|
89
|
-
/* c8 ignore next */ // ?
|
|
90
88
|
const createAssert = (nodeAssert) => {
|
|
91
89
|
const ok = (value, message) => {
|
|
92
90
|
(0, exports.processAssert)(() => {
|
|
@@ -137,7 +135,6 @@ const createAssert = (nodeAssert) => {
|
|
|
137
135
|
throw: true,
|
|
138
136
|
});
|
|
139
137
|
};
|
|
140
|
-
/* c8 ignore start */
|
|
141
138
|
const fail = (message) => {
|
|
142
139
|
(0, exports.processAssert)(() => {
|
|
143
140
|
nodeAssert.fail(message);
|
|
@@ -221,7 +218,7 @@ const createAssert = (nodeAssert) => {
|
|
|
221
218
|
});
|
|
222
219
|
}
|
|
223
220
|
const match = (value, regExp, message) => {
|
|
224
|
-
|
|
221
|
+
|
|
225
222
|
if (typeof get_runtime_js_1.nodeVersion === 'number' && get_runtime_js_1.nodeVersion < 12) {
|
|
226
223
|
throw new Error('match is available from Node.js 12 or higher');
|
|
227
224
|
}
|
|
@@ -233,7 +230,7 @@ const createAssert = (nodeAssert) => {
|
|
|
233
230
|
});
|
|
234
231
|
};
|
|
235
232
|
const doesNotMatch = (value, regExp, message) => {
|
|
236
|
-
|
|
233
|
+
|
|
237
234
|
if (typeof get_runtime_js_1.nodeVersion === 'number' && get_runtime_js_1.nodeVersion < 12) {
|
|
238
235
|
throw new Error('doesNotMatch is available from Node.js 12 or higher');
|
|
239
236
|
}
|
|
@@ -82,7 +82,7 @@ class DockerCompose {
|
|
|
82
82
|
this.verbose = verbose;
|
|
83
83
|
}
|
|
84
84
|
async up() {
|
|
85
|
-
const args = ['-f', this.file];
|
|
85
|
+
const args = ['compose', '-f', this.file];
|
|
86
86
|
if (this.envFile) {
|
|
87
87
|
args.push(...['--env-file', this.envFile]);
|
|
88
88
|
}
|
|
@@ -97,7 +97,7 @@ class DockerCompose {
|
|
|
97
97
|
if (this.serviceName) {
|
|
98
98
|
args.push(this.serviceName);
|
|
99
99
|
}
|
|
100
|
-
return await runDockerCommand('docker
|
|
100
|
+
return await runDockerCommand('docker', args, { cwd: this.cwd }, this.verbose);
|
|
101
101
|
}
|
|
102
102
|
async down() {
|
|
103
103
|
const args = ['-f', this.file];
|
|
@@ -107,7 +107,7 @@ class DockerCompose {
|
|
|
107
107
|
if (this.projectName) {
|
|
108
108
|
args.push(...['-p', this.projectName]);
|
|
109
109
|
}
|
|
110
|
-
return await runDockerCommand('docker
|
|
110
|
+
return await runDockerCommand('docker', ['compose', ...args, 'down'], { cwd: this.cwd }, this.verbose);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
exports.DockerCompose = DockerCompose;
|
package/lib/services/each.js
CHANGED
|
@@ -41,7 +41,6 @@ const beforeEach = async (fileRelative, configs) => {
|
|
|
41
41
|
return true;
|
|
42
42
|
};
|
|
43
43
|
exports.beforeEach = beforeEach;
|
|
44
|
-
/* c8 ignore next */ // ?
|
|
45
44
|
const afterEach = async (fileRelative, configs) => {
|
|
46
45
|
if (configs === null || configs === void 0 ? void 0 : configs.afterEach) {
|
|
47
46
|
return await eachCore('afterEach', fileRelative, configs);
|
package/lib/services/env.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveEnvVariables = exports.parseEnvLine = exports.removeComments = void 0;
|
|
4
|
-
/* c8 ignore next */ // ?
|
|
5
4
|
const removeComments = (input) => {
|
|
6
5
|
let output = '';
|
|
7
6
|
let quoteChar = '';
|
|
@@ -29,7 +28,6 @@ const removeComments = (input) => {
|
|
|
29
28
|
return output.trim();
|
|
30
29
|
};
|
|
31
30
|
exports.removeComments = removeComments;
|
|
32
|
-
/* c8 ignore net */ // ?
|
|
33
31
|
const parseEnvLine = (line) => {
|
|
34
32
|
const index = line.indexOf('=');
|
|
35
33
|
if (index === -1) {
|
|
@@ -43,7 +41,6 @@ const parseEnvLine = (line) => {
|
|
|
43
41
|
return { arg, value };
|
|
44
42
|
};
|
|
45
43
|
exports.parseEnvLine = parseEnvLine;
|
|
46
|
-
/* c8 ignore next */ // ?
|
|
47
44
|
const resolveEnvVariables = (str, env) => {
|
|
48
45
|
let result = '';
|
|
49
46
|
let i = 0;
|
package/lib/services/format.d.ts
CHANGED
package/lib/services/format.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getLargestStringLength = exports.format = exports.Formatter = exports.backgroundColor = void 0;
|
|
4
|
-
|
|
3
|
+
exports.showTestResults = exports.getLargestStringLength = exports.format = exports.Formatter = exports.backgroundColor = void 0;
|
|
4
|
+
const files_js_1 = require("../configs/files.js");
|
|
5
|
+
const indentation_js_1 = require("../configs/indentation.js");
|
|
6
|
+
const write_js_1 = require("../services/write.js");
|
|
5
7
|
exports.backgroundColor = {
|
|
6
8
|
white: 7,
|
|
7
9
|
black: 40,
|
|
@@ -76,6 +78,19 @@ class Formatter {
|
|
|
76
78
|
exports.Formatter = Formatter;
|
|
77
79
|
const format = (text) => Formatter.create(text);
|
|
78
80
|
exports.format = format;
|
|
79
|
-
/* c8 ignore next */ // ?
|
|
80
81
|
const getLargestStringLength = (arr) => arr.reduce((max, current) => Math.max(max, current.length), 0);
|
|
81
82
|
exports.getLargestStringLength = getLargestStringLength;
|
|
83
|
+
const showTestResults = () => {
|
|
84
|
+
write_js_1.Write.hr();
|
|
85
|
+
if (files_js_1.fileResults.success.size > 0) {
|
|
86
|
+
write_js_1.Write.log(Array.from(files_js_1.fileResults.success)
|
|
87
|
+
.map(([file, time]) => `${indentation_js_1.indentation.test}${(0, exports.format)('✔').success()} ${(0, exports.format)(`${file} ${(0, exports.format)(`› ${time}ms`).success()}`).dim()}`)
|
|
88
|
+
.join('\n'));
|
|
89
|
+
}
|
|
90
|
+
if (files_js_1.fileResults.fail.size > 0) {
|
|
91
|
+
write_js_1.Write.log(Array.from(files_js_1.fileResults.fail)
|
|
92
|
+
.map(([file, time]) => `${indentation_js_1.indentation.test}${(0, exports.format)('✘').fail()} ${(0, exports.format)(`${file} ${(0, exports.format)(`› ${time}ms`).fail()}`).dim()}`)
|
|
93
|
+
.join('\n'));
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
exports.showTestResults = showTestResults;
|
|
@@ -1,7 +1,6 @@
|
|
|
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
|
-
/* c8 ignore next */ // ?
|
|
5
4
|
const node_path_1 = require("path");
|
|
6
5
|
const fs_js_1 = require("../polyfills/fs.js");
|
|
7
6
|
const list_files_js_1 = require("../modules/helpers/list-files.js");
|
|
@@ -105,7 +104,6 @@ const createImportMap = async (allTestFiles, allSrcFiles) => {
|
|
|
105
104
|
}));
|
|
106
105
|
};
|
|
107
106
|
exports.createImportMap = createImportMap;
|
|
108
|
-
/* c8 ignore next */ // ?
|
|
109
107
|
const mapTests = async (srcDir, testPaths, testFilter, exclude) => {
|
|
110
108
|
const [allTestFiles, allSrcFiles] = await Promise.all([
|
|
111
109
|
collectTestFiles(testPaths, testFilter, exclude),
|
|
@@ -12,21 +12,19 @@ const output_js_1 = require("../parsers/output.js");
|
|
|
12
12
|
const each_js_1 = require("./each.js");
|
|
13
13
|
const write_js_1 = require("./write.js");
|
|
14
14
|
const cwd = (0, node_process_1.cwd)();
|
|
15
|
-
/* c8 ignore next */ // ?
|
|
16
15
|
const runTestFile = async (filePath, configs) => {
|
|
17
16
|
var _a, _b;
|
|
18
|
-
/* c8 ignore start */
|
|
19
17
|
const runtimeOptions = (0, get_runner_js_1.runner)(filePath, configs);
|
|
20
18
|
const runtime = runtimeOptions.shift();
|
|
21
19
|
const runtimeArguments = [
|
|
22
20
|
...runtimeOptions,
|
|
21
|
+
|
|
23
22
|
((_a = configs === null || configs === void 0 ? void 0 : configs.deno) === null || _a === void 0 ? void 0 : _a.cjs) === true ||
|
|
24
23
|
(Array.isArray((_b = configs === null || configs === void 0 ? void 0 : configs.deno) === null || _b === void 0 ? void 0 : _b.cjs) &&
|
|
25
24
|
configs.deno.cjs.some((ext) => filePath.includes(ext)))
|
|
26
25
|
? 'https://cdn.jsdelivr.net/npm/poku/lib/polyfills/deno.mjs'
|
|
27
26
|
: filePath,
|
|
28
27
|
];
|
|
29
|
-
/* c8 ignore stop */
|
|
30
28
|
const fileRelative = (0, node_path_1.relative)(cwd, filePath);
|
|
31
29
|
const showLogs = !(0, output_js_1.isQuiet)(configs);
|
|
32
30
|
let output = '';
|
|
@@ -78,7 +76,7 @@ const runTestFile = async (filePath, configs) => {
|
|
|
78
76
|
}
|
|
79
77
|
resolve(result);
|
|
80
78
|
});
|
|
81
|
-
|
|
79
|
+
|
|
82
80
|
child.on('error', (err) => {
|
|
83
81
|
end = (0, node_process_1.hrtime)(start);
|
|
84
82
|
const total = (end[0] * 1e3 + end[1] / 1e6).toFixed(6);
|
|
@@ -86,7 +84,6 @@ const runTestFile = async (filePath, configs) => {
|
|
|
86
84
|
files_js_1.fileResults.fail.set(fileRelative, total);
|
|
87
85
|
resolve(false);
|
|
88
86
|
});
|
|
89
|
-
/* c8 ignore stop */
|
|
90
87
|
});
|
|
91
88
|
};
|
|
92
89
|
exports.runTestFile = runTestFile;
|
|
@@ -17,13 +17,11 @@ const runTests = async (dir, configs) => {
|
|
|
17
17
|
const testDir = (0, node_path_1.join)(cwd, dir);
|
|
18
18
|
const currentDir = (0, node_path_1.relative)(cwd, testDir);
|
|
19
19
|
const isFile = await (0, list_files_js_1.isFile)(testDir);
|
|
20
|
-
const files =
|
|
21
|
-
? [(0, list_files_js_1.sanitizePath)(testDir)]
|
|
22
|
-
: await (0, list_files_js_1.listFiles)(testDir, configs);
|
|
20
|
+
const files = await (0, list_files_js_1.listFiles)(testDir, configs);
|
|
23
21
|
const totalTests = files.length;
|
|
24
22
|
const showLogs = !(0, output_js_1.isQuiet)(configs);
|
|
25
23
|
let passed = true;
|
|
26
|
-
if (showLogs) {
|
|
24
|
+
if (showLogs && files.length > 0) {
|
|
27
25
|
write_js_1.Write.hr();
|
|
28
26
|
write_js_1.Write.log(`${(0, format_js_1.format)(isFile ? 'File:' : 'Directory:').bold()} ${(0, format_js_1.format)(`.${node_path_1.sep}${currentDir}`).underline()}\n`);
|
|
29
27
|
}
|
|
@@ -43,7 +41,6 @@ const runTests = async (dir, configs) => {
|
|
|
43
41
|
++poku_js_1.results.success;
|
|
44
42
|
showLogs &&
|
|
45
43
|
write_js_1.Write.log(`${indentation_js_1.indentation.test}${(0, format_js_1.format)('✔').success()} ${log}${(0, format_js_1.format)(` › ${total}ms`).success().dim()}${nextLine}`);
|
|
46
|
-
/* c8 ignore start */
|
|
47
44
|
}
|
|
48
45
|
else {
|
|
49
46
|
++poku_js_1.results.fail;
|
|
@@ -59,20 +56,16 @@ const runTests = async (dir, configs) => {
|
|
|
59
56
|
break;
|
|
60
57
|
}
|
|
61
58
|
}
|
|
62
|
-
/* c8 ignore stop */
|
|
63
59
|
}
|
|
64
60
|
return passed;
|
|
65
61
|
};
|
|
66
62
|
exports.runTests = runTests;
|
|
67
|
-
/* c8 ignore next */ // ?
|
|
68
63
|
const runTestsParallel = async (dir, configs) => {
|
|
69
64
|
var _a;
|
|
70
65
|
const testDir = (0, node_path_1.join)(cwd, dir);
|
|
71
|
-
const files =
|
|
72
|
-
? [(0, list_files_js_1.sanitizePath)(dir)]
|
|
73
|
-
: await (0, list_files_js_1.listFiles)(testDir, configs);
|
|
66
|
+
const files = await (0, list_files_js_1.listFiles)(testDir, configs);
|
|
74
67
|
const filesByConcurrency = [];
|
|
75
|
-
const concurrencyLimit = (_a = configs === null || configs === void 0 ? void 0 : configs.concurrency) !== null && _a !== void 0 ? _a : (0, cpus_js_1.availableParallelism)();
|
|
68
|
+
const concurrencyLimit = (_a = configs === null || configs === void 0 ? void 0 : configs.concurrency) !== null && _a !== void 0 ? _a : Math.max(Math.floor((0, cpus_js_1.availableParallelism)() / 2), 1);
|
|
76
69
|
const concurrencyResults = [];
|
|
77
70
|
const showLogs = !(0, output_js_1.isQuiet)(configs);
|
|
78
71
|
if (concurrencyLimit > 0) {
|
|
@@ -86,9 +79,6 @@ const runTestsParallel = async (dir, configs) => {
|
|
|
86
79
|
try {
|
|
87
80
|
for (const fileGroup of filesByConcurrency) {
|
|
88
81
|
const promises = fileGroup.map(async (filePath) => {
|
|
89
|
-
if ((configs === null || configs === void 0 ? void 0 : configs.failFast) && poku_js_1.results.fail > 0) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
82
|
const testPassed = await (0, run_test_file_js_1.runTestFile)(filePath, configs);
|
|
93
83
|
if (!testPassed) {
|
|
94
84
|
++poku_js_1.results.fail;
|
|
@@ -104,7 +94,6 @@ const runTestsParallel = async (dir, configs) => {
|
|
|
104
94
|
concurrencyResults.push(concurrency);
|
|
105
95
|
}
|
|
106
96
|
return concurrencyResults.every((group) => group.every((result) => result));
|
|
107
|
-
/* c8 ignore start */
|
|
108
97
|
}
|
|
109
98
|
catch (error) {
|
|
110
99
|
if (showLogs) {
|
|
@@ -113,6 +102,5 @@ const runTestsParallel = async (dir, configs) => {
|
|
|
113
102
|
}
|
|
114
103
|
return false;
|
|
115
104
|
}
|
|
116
|
-
/* c8 ignore stop */
|
|
117
105
|
};
|
|
118
106
|
exports.runTestsParallel = runTestsParallel;
|
package/lib/services/watch.js
CHANGED
|
@@ -20,10 +20,6 @@ class Watcher {
|
|
|
20
20
|
const watcher = (0, node_fs_1.watch)(filePath, (eventType) => {
|
|
21
21
|
this.callback(filePath, eventType);
|
|
22
22
|
});
|
|
23
|
-
/* c8 ignore next 3 */
|
|
24
|
-
watcher.on('error', () => {
|
|
25
|
-
return;
|
|
26
|
-
});
|
|
27
23
|
this.fileWatchers.set(filePath, watcher);
|
|
28
24
|
}
|
|
29
25
|
unwatchFiles() {
|
|
@@ -52,15 +48,10 @@ class Watcher {
|
|
|
52
48
|
if (stats.isDirectory()) {
|
|
53
49
|
await this.watchDirectory(fullPath);
|
|
54
50
|
}
|
|
55
|
-
/* c8 ignore next */
|
|
56
51
|
}
|
|
57
52
|
catch (_a) { }
|
|
58
53
|
}
|
|
59
54
|
});
|
|
60
|
-
/* c8 ignore next 3 */
|
|
61
|
-
watcher.on('error', () => {
|
|
62
|
-
return;
|
|
63
|
-
});
|
|
64
55
|
this.dirWatchers.set(dir, watcher);
|
|
65
56
|
const entries = await (0, fs_js_1.readdir)(dir, { withFileTypes: true });
|
|
66
57
|
for (const entry of entries) {
|
|
@@ -81,7 +72,6 @@ class Watcher {
|
|
|
81
72
|
else {
|
|
82
73
|
this.watchFile(this.rootDir);
|
|
83
74
|
}
|
|
84
|
-
/* c8 ignore next */
|
|
85
75
|
}
|
|
86
76
|
catch (_a) { }
|
|
87
77
|
}
|
|
@@ -97,7 +87,6 @@ class Watcher {
|
|
|
97
87
|
}
|
|
98
88
|
}
|
|
99
89
|
exports.Watcher = Watcher;
|
|
100
|
-
/* c8 ignore next */ // ?
|
|
101
90
|
const watch = async (path, callback) => {
|
|
102
91
|
const watcher = new Watcher(path, callback);
|
|
103
92
|
await watcher.start();
|
package/lib/services/write.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poku",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.4",
|
|
4
4
|
"description": "🐷 Poku makes testing easy for Node.js, Bun, Deno, and you at the same time.",
|
|
5
5
|
"main": "./lib/modules/index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,7 +39,9 @@
|
|
|
39
39
|
"test:bun:parallel": "bun src/bin/index.ts --bun -p test/unit test/integration test/e2e",
|
|
40
40
|
"test:deno:sequential": "tsx src/bin/index.ts --deno --deno-allow=all --deno-cjs ci/test/unit ci/test/integration ci/test/e2e",
|
|
41
41
|
"test:deno:parallel": "tsx src/bin/index.ts --deno --deno-allow=all --deno-cjs -p ci/test/unit ci/test/integration ci/test/e2e",
|
|
42
|
-
"
|
|
42
|
+
"pretest:c8": "tsx tools/build/c8-file.ts",
|
|
43
|
+
"test:c8": "c8 --experimental-monocart tsx test/c8.test.ts",
|
|
44
|
+
"posttest:c8": "rm -rf ./.nycrc.json",
|
|
43
45
|
"test:ci": "tsx test/ci.test.ts",
|
|
44
46
|
"test:ci:node": "FILTER='node-' npm run test:ci",
|
|
45
47
|
"test:ci:bun": "FILTER='bun-' npm run test:ci",
|
|
@@ -49,7 +51,7 @@
|
|
|
49
51
|
"clear": "rm -rf lib ci coverage .temp test-src test-tests",
|
|
50
52
|
"prebuild": "npm run clear",
|
|
51
53
|
"build": "tsc && tsc -p tsconfig.test.json",
|
|
52
|
-
"postbuild": "tsx tools/compatibility/node.ts && cp fixtures/server/package.json ci/fixtures/server/package.json && npm run build:deno && chmod +x lib/bin/index.js",
|
|
54
|
+
"postbuild": "tsx tools/compatibility/node.ts && tsx tools/compatibility/comments.ts && cp fixtures/server/package.json ci/fixtures/server/package.json && rm -f ./lib/@types/*.js ./lib/bin/*.ts && npm run build:deno && chmod +x lib/bin/index.js",
|
|
53
55
|
"build:deno": "tsc -p tsconfig.mjs.json",
|
|
54
56
|
"postbuild:deno": "tsx tools/build/check-deno-polyfill.ts",
|
|
55
57
|
"lint": "npx @biomejs/biome lint && prettier --check .",
|
|
@@ -62,6 +64,8 @@
|
|
|
62
64
|
"@biomejs/biome": "1.8.3",
|
|
63
65
|
"@types/node": "^20.14.12",
|
|
64
66
|
"c8": "^10.1.2",
|
|
67
|
+
"jsonc.min": "^1.0.0",
|
|
68
|
+
"monocart-coverage-reports": "^2.9.3",
|
|
65
69
|
"packages-update": "^2.0.0",
|
|
66
70
|
"prettier": "^3.3.3",
|
|
67
71
|
"tsx": "4.16.2",
|
package/lib/@types/assert.js
DELETED
package/lib/@types/code.js
DELETED
package/lib/@types/container.js
DELETED
package/lib/@types/describe.js
DELETED
package/lib/@types/each.js
DELETED
package/lib/@types/list-files.js
DELETED
package/lib/@types/poku.js
DELETED
package/lib/@types/runner.js
DELETED
package/lib/@types/wait-for.js
DELETED
package/lib/@types/watch.js
DELETED
package/lib/bin/index.d.ts
DELETED