poku 2.2.1 → 2.2.2
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/configs/indentation.d.ts +1 -2
- package/lib/configs/indentation.js +1 -2
- package/lib/modules/helpers/describe.js +0 -1
- package/lib/modules/helpers/it.js +48 -37
- package/lib/modules/helpers/test.d.ts +2 -4
- package/lib/modules/helpers/test.js +3 -49
- package/lib/parsers/options.js +1 -25
- package/lib/services/assert.js +3 -8
- package/package.json +2 -2
|
@@ -28,7 +28,6 @@ async function describe(arg1, arg2) {
|
|
|
28
28
|
if (title) {
|
|
29
29
|
indentation_js_1.indentation.hasDescribe = true;
|
|
30
30
|
const { background, icon } = options || {};
|
|
31
|
-
/* c8 ignore next */
|
|
32
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() || ''}`;
|
|
33
32
|
const noBackground = !background;
|
|
34
33
|
if (noBackground) {
|
|
@@ -9,45 +9,56 @@ const format_js_1 = require("../../services/format.js");
|
|
|
9
9
|
const write_js_1 = require("../../services/write.js");
|
|
10
10
|
/* c8 ignore next */ // ?
|
|
11
11
|
async function it(...args) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
else {
|
|
21
|
-
cb = args[0];
|
|
22
|
-
}
|
|
23
|
-
if (message) {
|
|
24
|
-
indentation_js_1.indentation.hasIt = true;
|
|
25
|
-
write_js_1.Write.log(isPoku && !indentation_js_1.indentation.hasDescribe
|
|
26
|
-
? /* c8 ignore next 2 */
|
|
27
|
-
`${indentation_js_1.indentation.hasDescribe ? ' ' : ''}${(0, format_js_1.format)(`◌ ${message} › ${(0, format_js_1.format)(`${FILE}`).italic().gray()}`).dim()}`
|
|
28
|
-
: `${indentation_js_1.indentation.hasDescribe ? ' ' : ''}${(0, format_js_1.format)(`◌ ${message}`).dim()}`);
|
|
29
|
-
}
|
|
30
|
-
if (typeof each_js_1.each.before.cb === 'function') {
|
|
31
|
-
const beforeResult = each_js_1.each.before.cb();
|
|
32
|
-
if (beforeResult instanceof Promise) {
|
|
33
|
-
await beforeResult;
|
|
12
|
+
try {
|
|
13
|
+
let message;
|
|
14
|
+
let cb;
|
|
15
|
+
const isPoku = typeof (node_process_1.env === null || node_process_1.env === void 0 ? void 0 : node_process_1.env.FILE) === 'string' && (node_process_1.env === null || node_process_1.env === void 0 ? void 0 : node_process_1.env.FILE.length) > 0;
|
|
16
|
+
const FILE = node_process_1.env.FILE;
|
|
17
|
+
if (typeof args[0] === 'string') {
|
|
18
|
+
message = args[0];
|
|
19
|
+
cb = args[1];
|
|
34
20
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (
|
|
45
|
-
|
|
21
|
+
else {
|
|
22
|
+
cb = args[0];
|
|
23
|
+
}
|
|
24
|
+
if (message) {
|
|
25
|
+
indentation_js_1.indentation.hasItOrTest = true;
|
|
26
|
+
write_js_1.Write.log(isPoku && !indentation_js_1.indentation.hasDescribe
|
|
27
|
+
? `${indentation_js_1.indentation.hasDescribe ? ' ' : ''}${(0, format_js_1.format)(`◌ ${message} › ${(0, format_js_1.format)(`${FILE}`).italic().gray()}`).dim()}`
|
|
28
|
+
: `${indentation_js_1.indentation.hasDescribe ? ' ' : ''}${(0, format_js_1.format)(`◌ ${message}`).dim()}`);
|
|
29
|
+
}
|
|
30
|
+
if (typeof each_js_1.each.before.cb === 'function') {
|
|
31
|
+
const beforeResult = each_js_1.each.before.cb();
|
|
32
|
+
if (beforeResult instanceof Promise) {
|
|
33
|
+
await beforeResult;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const start = (0, node_process_1.hrtime)();
|
|
37
|
+
const resultCb = cb();
|
|
38
|
+
if (resultCb instanceof Promise) {
|
|
39
|
+
await resultCb;
|
|
40
|
+
}
|
|
41
|
+
const end = (0, node_process_1.hrtime)(start);
|
|
42
|
+
if (typeof each_js_1.each.after.cb === 'function') {
|
|
43
|
+
const afterResult = each_js_1.each.after.cb();
|
|
44
|
+
if (afterResult instanceof Promise) {
|
|
45
|
+
await afterResult;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (message) {
|
|
49
|
+
const total = (end[0] * 1e3 + end[1] / 1e6).toFixed(6);
|
|
50
|
+
indentation_js_1.indentation.hasItOrTest = false;
|
|
51
|
+
write_js_1.Write.log(`${indentation_js_1.indentation.hasDescribe ? ' ' : ''}${(0, format_js_1.format)(`● ${message}`).success().bold()} ${(0, format_js_1.format)(`› ${total}ms`).success().dim()}`);
|
|
46
52
|
}
|
|
47
53
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
catch (error) {
|
|
55
|
+
indentation_js_1.indentation.hasItOrTest = false;
|
|
56
|
+
if (typeof each_js_1.each.after.cb === 'function') {
|
|
57
|
+
const afterResult = each_js_1.each.after.cb();
|
|
58
|
+
if (afterResult instanceof Promise) {
|
|
59
|
+
await afterResult;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
throw error;
|
|
52
63
|
}
|
|
53
64
|
}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare
|
|
3
|
-
export declare function test(cb: () => Promise<unknown>): Promise<void>;
|
|
4
|
-
export declare function test(cb: () => unknown): void;
|
|
1
|
+
import { it } from './it.js';
|
|
2
|
+
export declare const test: typeof it;
|
|
@@ -1,53 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.test =
|
|
3
|
+
exports.test = void 0;
|
|
4
4
|
/* c8 ignore next */ // ?
|
|
5
|
-
const
|
|
6
|
-
const each_js_1 = require("../../configs/each.js");
|
|
7
|
-
const indentation_js_1 = require("../../configs/indentation.js");
|
|
8
|
-
const format_js_1 = require("../../services/format.js");
|
|
9
|
-
const write_js_1 = require("../../services/write.js");
|
|
5
|
+
const it_js_1 = require("./it.js");
|
|
10
6
|
/* c8 ignore next */ // ?
|
|
11
|
-
|
|
12
|
-
let message;
|
|
13
|
-
let cb;
|
|
14
|
-
const isPoku = typeof (node_process_1.env === null || node_process_1.env === void 0 ? void 0 : node_process_1.env.FILE) === 'string' && (node_process_1.env === null || node_process_1.env === void 0 ? void 0 : node_process_1.env.FILE.length) > 0;
|
|
15
|
-
const FILE = node_process_1.env.FILE;
|
|
16
|
-
if (typeof args[0] === 'string') {
|
|
17
|
-
message = args[0];
|
|
18
|
-
cb = args[1];
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
cb = args[0];
|
|
22
|
-
}
|
|
23
|
-
if (message) {
|
|
24
|
-
indentation_js_1.indentation.hasTest = true;
|
|
25
|
-
write_js_1.Write.log(isPoku
|
|
26
|
-
? /* c8 ignore next 2 */
|
|
27
|
-
(0, format_js_1.format)(`◌ ${message} › ${(0, format_js_1.format)(`${FILE}`).italic().gray()}`).dim()
|
|
28
|
-
: (0, format_js_1.format)(`◌ ${message}`).dim());
|
|
29
|
-
}
|
|
30
|
-
if (typeof each_js_1.each.before.cb === 'function') {
|
|
31
|
-
const beforeResult = each_js_1.each.before.cb();
|
|
32
|
-
if (beforeResult instanceof Promise) {
|
|
33
|
-
await beforeResult;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
const start = (0, node_process_1.hrtime)();
|
|
37
|
-
const resultCb = cb();
|
|
38
|
-
if (resultCb instanceof Promise) {
|
|
39
|
-
await resultCb;
|
|
40
|
-
}
|
|
41
|
-
const end = (0, node_process_1.hrtime)(start);
|
|
42
|
-
if (typeof each_js_1.each.after.cb === 'function') {
|
|
43
|
-
const afterResult = each_js_1.each.after.cb();
|
|
44
|
-
if (afterResult instanceof Promise) {
|
|
45
|
-
await afterResult;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (message) {
|
|
49
|
-
const total = (end[0] * 1e3 + end[1] / 1e6).toFixed(6);
|
|
50
|
-
indentation_js_1.indentation.hasTest = false;
|
|
51
|
-
write_js_1.Write.log(`${(0, format_js_1.format)(`● ${message}`).success().bold()} ${(0, format_js_1.format)(`› ${total}ms`).success().dim()}`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
7
|
+
exports.test = it_js_1.it;
|
package/lib/parsers/options.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.getConfigs = void 0;
|
|
27
4
|
const node_process_1 = require("process");
|
|
@@ -43,8 +20,7 @@ const getConfigs = async (customPath) => {
|
|
|
43
20
|
const filePath = (0, node_path_1.join)(processCWD, file);
|
|
44
21
|
try {
|
|
45
22
|
if (filePath.endsWith('.js') || filePath.endsWith('.cjs')) {
|
|
46
|
-
|
|
47
|
-
return (await Promise.resolve(`${(0, node_path_1.normalize)(filePath)}`).then(s => __importStar(require(s))));
|
|
23
|
+
return require(`file://${(0, node_path_1.normalize)(filePath)}`);
|
|
48
24
|
}
|
|
49
25
|
const configsFile = await (0, fs_js_1.readFile)(filePath, 'utf-8');
|
|
50
26
|
return jsonc_js_1.JSONC.parse(configsFile);
|
package/lib/services/assert.js
CHANGED
|
@@ -19,10 +19,10 @@ const processAssert = async (cb, options) => {
|
|
|
19
19
|
const isPoku = typeof (node_process_1.env === null || node_process_1.env === void 0 ? void 0 : node_process_1.env.FILE) === 'string' && (node_process_1.env === null || node_process_1.env === void 0 ? void 0 : node_process_1.env.FILE.length) > 0;
|
|
20
20
|
const FILE = node_process_1.env.FILE;
|
|
21
21
|
let preIdentation = '';
|
|
22
|
-
if (indentation_js_1.indentation.hasDescribe
|
|
22
|
+
if (indentation_js_1.indentation.hasDescribe) {
|
|
23
23
|
preIdentation += ' ';
|
|
24
24
|
}
|
|
25
|
-
if (indentation_js_1.indentation.
|
|
25
|
+
if (indentation_js_1.indentation.hasItOrTest) {
|
|
26
26
|
preIdentation += ' ';
|
|
27
27
|
}
|
|
28
28
|
try {
|
|
@@ -31,11 +31,7 @@ const processAssert = async (cb, options) => {
|
|
|
31
31
|
await cbResult;
|
|
32
32
|
}
|
|
33
33
|
if (typeof options.message === 'string') {
|
|
34
|
-
const message = isPoku &&
|
|
35
|
-
!indentation_js_1.indentation.hasDescribe &&
|
|
36
|
-
!indentation_js_1.indentation.hasIt &&
|
|
37
|
-
/* c8 ignore next 2 */
|
|
38
|
-
!indentation_js_1.indentation.hasTest
|
|
34
|
+
const message = isPoku && !indentation_js_1.indentation.hasDescribe && !indentation_js_1.indentation.hasItOrTest
|
|
39
35
|
? `${preIdentation}${(0, format_js_1.format)(`${(0, format_js_1.format)(`✔ ${options.message}`).bold()} ${(0, format_js_1.format)(`› ${FILE}`).success().dim()}`).success()}`
|
|
40
36
|
: `${preIdentation}${(0, format_js_1.format)(`✔ ${options.message}`).success().bold()}`;
|
|
41
37
|
write_js_1.Write.log(message);
|
|
@@ -88,7 +84,6 @@ const processAssert = async (cb, options) => {
|
|
|
88
84
|
// Non-assertion errors
|
|
89
85
|
throw error;
|
|
90
86
|
}
|
|
91
|
-
/* c8 ignore stop */
|
|
92
87
|
};
|
|
93
88
|
exports.processAssert = processAssert;
|
|
94
89
|
/* c8 ignore next */ // ?
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poku",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
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",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@biomejs/biome": "1.8.3",
|
|
63
|
-
"@types/node": "^20.14.
|
|
63
|
+
"@types/node": "^20.14.12",
|
|
64
64
|
"c8": "^10.1.2",
|
|
65
65
|
"packages-update": "^2.0.0",
|
|
66
66
|
"prettier": "^3.3.3",
|