poku 1.21.0 โ†’ 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,20 +1,20 @@
1
1
  <div align="center">
2
- <img width="125" height="125" alt="Logo" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/poku.svg">
2
+ <img height="180" alt="Poku's Logo" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/poku.svg">
3
3
 
4
4
  # Poku
5
5
 
6
6
  Enjoying **Poku**? Give him a star to show your support ๐ŸŒŸ
7
7
 
8
- [![NPM Downloads][downloads-image]][downloads-url]
9
- [![Coverage][coverage-image]][coverage-url]
10
- [![License][license-image]][license-url]<br />
11
- [![GitHub Workflow Status (with event)][ci-linux-image]][ci-linux-url]
12
- [![GitHub Workflow Status (with event)][ci-osx-image]][ci-osx-url]
13
- [![GitHub Workflow Status (with event)][ci-windows-image]][ci-windows-url]
8
+ [![NPM Downloads](https://img.shields.io/npm/dt/poku.svg?logo=npm&logoColor=white&color=1e90ff)](https://www.npmjs.com/package/poku)
9
+ [![Coverage](https://img.shields.io/codecov/c/github/wellwelwel/poku)](https://app.codecov.io/github/wellwelwel/poku)
10
+ [![License](https://img.shields.io/npm/l/poku?maxAge=2592000&color=9c88ff)](https://github.com/wellwelwel/poku/blob/main/LICENSE)<br />
11
+ [![GitHub Workflow Status (Linux)](https://img.shields.io/github/actions/workflow/status/wellwelwel/poku/ci_coverage-linux.yml?event=push&label=&branch=main&logo=ubuntu&logoColor=white)](https://github.com/wellwelwel/poku/actions/workflows/ci_coverage-linux.yml?query=branch%3Amain)
12
+ [![GitHub Workflow Status (OSX)](https://img.shields.io/github/actions/workflow/status/wellwelwel/poku/ci_coverage-osx.yml?event=push&label=&branch=main&logo=apple&logoColor=white)](https://github.com/wellwelwel/poku/actions/workflows/ci_coverage-osx.yml?query=branch%3Amain)
13
+ [![GitHub Workflow Status (Windows)](https://img.shields.io/github/actions/workflow/status/wellwelwel/poku/ci_coverage-windows.yml?event=push&label=&branch=main&logo=windows&logoColor=white)](https://github.com/wellwelwel/poku/actions/workflows/ci_coverage-windows.yml?query=branch%3Amain)
14
14
 
15
15
  ---
16
16
 
17
- ๐Ÿท [Documentation](https://poku.io)<span>&nbsp;&nbsp;โ€ข&nbsp;&nbsp;</span>๐Ÿงช [Examples](https://poku.io/docs/category/examples)<span>&nbsp;&nbsp;โ€ข&nbsp;&nbsp;</span>๐Ÿ”ฌ [Compare the Most Popular Test Runners](https://poku.io/docs/comparing)
17
+ ๐Ÿท [Website](https://poku.io/)<span>&nbsp;&nbsp;โ€ข&nbsp;&nbsp;</span>๐Ÿ“’ [Documentation](https://poku.io/docs/category/documentation)<span>&nbsp;&nbsp;โ€ข&nbsp;&nbsp;</span>๐Ÿงช [Examples](https://poku.io/docs/category/examples)<span>&nbsp;&nbsp;โ€ข&nbsp;&nbsp;</span>๐Ÿง‘๐Ÿปโ€๐ŸŽ“ [Quick Tutorials](https://poku.io/docs/category/quick-tutorials)
18
18
 
19
19
  </div>
20
20
 
@@ -22,7 +22,7 @@ Enjoying **Poku**? Give him a star to show your support ๐ŸŒŸ
22
22
 
23
23
  ## Why does Poku exist?
24
24
 
25
- ๐Ÿ’ก **Poku** makes testing easy and brings the [native **JavaScript** syntax back to tests](https://poku.io/docs/philosophy), letting you to write tests intuitively โ€” _just like in real **JavaScript** code_.
25
+ ๐Ÿ’ก **Poku** makes testing easy and brings the [native **JavaScript** syntax back to tests](https://poku.io/docs/philosophy#javascript-essence-for-tests-), letting you to write tests intuitively โ€” _just like in real **JavaScript** code_.
26
26
 
27
27
  <img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> No configurations<br />
28
28
  <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Auto detect **ESM**, **CJS**, and **TypeScript** files<br />
@@ -154,7 +154,6 @@ deno run npm:poku
154
154
  ### Helpers
155
155
 
156
156
  - [**test**](https://poku.io/docs/documentation/helpers/test), [**describe**](https://poku.io/docs/documentation/helpers/describe) and [**it**](https://poku.io/docs/documentation/helpers/it) _(organize, group, and isolate tests)_
157
- - [**watch**](https://poku.io/docs/documentation/poku/options/watch) _(watch for changes and re-run related test files)_
158
157
  - [**beforeEach**](https://poku.io/docs/category/-before-and-after-each) and [**afterEach**](https://poku.io/docs/category/-before-and-after-each) _(hooks for test setup and teardown)_
159
158
  - [**docker**](https://poku.io/docs/documentation/helpers/containers) _(build, start, compose, stop, remove, and test containers)_
160
159
  - [**startScript**](https://poku.io/docs/documentation/helpers/startScript) _(run **package.json** scripts in background)_
@@ -163,7 +162,14 @@ deno run npm:poku
163
162
  - [**waitForPort**](https://poku.io/docs/documentation/helpers/processes/wait-for-port) _(wait for specified ports to become active)_
164
163
  - [**waitForExpectedResult**](https://poku.io/docs/documentation/helpers/processes/wait-for-expected-result) _(retry until an expected result or times out)_
165
164
  - [**getPIDs**](https://poku.io/docs/documentation/helpers/processes/get-pids) _(debug processes IDs using ports and port ranges)_
166
- - _and much more_ ๐Ÿ‘‡๐Ÿป
165
+
166
+ ### Common Options
167
+
168
+ - [**watch**](https://poku.io/docs/documentation/poku/options/watch) _(watch for changes and re-run related test files)_
169
+ - [**parallel**](https://poku.io/docs/documentation/poku/options/parallel) _(run tests in parallel)_
170
+ - [**debug**](https://poku.io/docs/documentation/poku/options/debug) _(shows all logs)_
171
+
172
+ > _and much more_ ๐Ÿ‘‡๐Ÿป
167
173
 
168
174
  ---
169
175
 
@@ -173,6 +179,19 @@ To see the detailed documentation, please visit the [**Documentation**](https://
173
179
 
174
180
  ---
175
181
 
182
+ ### Tutorials
183
+
184
+ **Poku** offers _mini-lessons_ for different users needs in the [**Quick Tutorials**](https://poku.io/docs/category/quick-tutorials) section.
185
+
186
+ ---
187
+
188
+ ### Common Issues
189
+
190
+ - [Avoiding conflicts in environments with multiple platforms installed](https://poku.io/docs/tutorials/cross-platform#recommendations).
191
+ - [Properly running asynchronous tests on the same file](https://poku.io/docs/examples/promises).
192
+
193
+ ---
194
+
176
195
  ## Contributing
177
196
 
178
197
  See the [**Contributing Guide**](https://github.com/wellwelwel/poku/blob/main/CONTRIBUTING.md) and please follow our [**Code of Conduct**](https://github.com/wellwelwel/poku/blob/main/CODE_OF_CONDUCT.md) ๐Ÿš€
@@ -181,7 +200,7 @@ See the [**Contributing Guide**](https://github.com/wellwelwel/poku/blob/main/CO
181
200
 
182
201
  ## Security Policy
183
202
 
184
- [![GitHub Workflow Status (with event)][ql-image]][ql-url]
203
+ [![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/wellwelwel/poku/ci_codeql.yml?event=push&label=&branch=main&logo=github&logoColor=white)](https://github.com/wellwelwel/poku/actions/workflows/ci_codeql.yml?query=branch%3Amain)
185
204
 
186
205
  Please check the [**SECURITY.md**](https://github.com/wellwelwel/poku/blob/main/SECURITY.md).
187
206
 
@@ -191,7 +210,7 @@ Please check the [**SECURITY.md**](https://github.com/wellwelwel/poku/blob/main/
191
210
 
192
211
  ### Performance
193
212
 
194
- **Poku** is [continuously tested](https://github.com/wellwelwel/poku/blob/main/.github/workflows/ci_benchmark.yml) to ensure the following expectations:
213
+ **Poku** is [continuously tested](https://github.com/wellwelwel/poku/blob/main/.github/workflows/ci_benchmark.yml) to ensure the following expectations for basic usage:
195
214
 
196
215
  - **~4x** faster than [**Jest**](https://github.com/jestjs/jest) (v29.7.0)
197
216
  - **~3x** faster than [**Vitest**](https://github.com/vitest-dev/vitest) (v1.6.0)
@@ -215,8 +234,11 @@ Please check the [**SECURITY.md**](https://github.com/wellwelwel/poku/blob/main/
215
234
 
216
235
  ### Limitations
217
236
 
218
- - Although it has no external dependencies, **Poku** is not _all-in-one_, so it doesn't have features such as _mocks_, _spies_, _coverage reports_, etc., where you can use your favorite packages or native solutions.
219
- - **Poku** community is gradually building up.
237
+ - Although it has no external dependencies, **Poku** is not _all-in-one_, so it doesn't have integrated features such as _mocks_, _spies_, _coverage reports_, etc., where you can use your favorite packages or native solutions.
238
+ - See a [mock example](https://poku.io/docs/category/mock).
239
+ - **Poku** doesn't render components (such as **Angular**, **React**, etc.).
240
+ - See an [_end-to-end_ test example](https://poku.io/docs/examples/browser/react).
241
+ - Our community is gradually building up.
220
242
 
221
243
  ---
222
244
 
@@ -235,18 +257,3 @@ Please check the [**SECURITY.md**](https://github.com/wellwelwel/poku/blob/main/
235
257
  [node-version-url]: https://github.com/nodejs/node
236
258
  [bun-version-url]: https://github.com/oven-sh/bun
237
259
  [deno-version-url]: https://github.com/denoland/deno
238
- [typescript-url]: https://github.com/microsoft/TypeScript
239
- [ci-linux-url]: https://github.com/wellwelwel/poku/actions/workflows/ci_coverage-linux.yml?query=branch%3Amain
240
- [ci-linux-image]: https://img.shields.io/github/actions/workflow/status/wellwelwel/poku/ci_coverage-linux.yml?event=push&label=&branch=main&logo=ubuntu&logoColor=white
241
- [ci-osx-url]: https://github.com/wellwelwel/poku/actions/workflows/ci_coverage-osx.yml?query=branch%3Amain
242
- [ci-osx-image]: https://img.shields.io/github/actions/workflow/status/wellwelwel/poku/ci_coverage-osx.yml?event=push&label=&branch=main&logo=apple&logoColor=white
243
- [ci-windows-url]: https://github.com/wellwelwel/poku/actions/workflows/ci_coverage-windows.yml?query=branch%3Amain
244
- [ci-windows-image]: https://img.shields.io/github/actions/workflow/status/wellwelwel/poku/ci_coverage-windows.yml?event=push&label=&branch=main&logo=windows&logoColor=white
245
- [ql-url]: https://github.com/wellwelwel/poku/actions/workflows/ci_codeql.yml?query=branch%3Amain
246
- [ql-image]: https://img.shields.io/github/actions/workflow/status/wellwelwel/poku/ci_codeql.yml?event=push&label=&branch=main&logo=github&logoColor=white
247
- [coverage-image]: https://img.shields.io/codecov/c/github/wellwelwel/poku
248
- [coverage-url]: https://app.codecov.io/github/wellwelwel/poku
249
- [downloads-image]: https://img.shields.io/npm/dt/poku.svg?logo=npm&logoColor=white&color=1e90ff
250
- [downloads-url]: https://www.npmjs.com/package/poku
251
- [license-url]: https://github.com/wellwelwel/poku/blob/main/LICENSE
252
- [license-image]: https://img.shields.io/npm/l/poku?maxAge=2592000&color=9c88ff
@@ -1,4 +1,5 @@
1
1
  export declare const results: {
2
2
  success: number;
3
3
  fail: number;
4
+ skipped: number;
4
5
  };
@@ -4,4 +4,5 @@ exports.results = void 0;
4
4
  exports.results = {
5
5
  success: 0,
6
6
  fail: 0,
7
+ skipped: 0,
7
8
  };
@@ -24,7 +24,7 @@ export declare const assert: ((value: unknown, message?: ProcessAssertionOptions
24
24
  notDeepStrictEqual: (actual: unknown, expected: unknown, message?: ProcessAssertionOptions["message"]) => void;
25
25
  match: (value: string, regExp: RegExp, message?: ProcessAssertionOptions["message"]) => void;
26
26
  ifError: (value: unknown, message?: ProcessAssertionOptions["message"]) => void;
27
- fail: (message?: ProcessAssertionOptions["message"]) => void;
27
+ fail: (message?: ProcessAssertionOptions["message"]) => never;
28
28
  rejects: typeof rejects;
29
29
  };
30
30
  export {};
@@ -94,6 +94,7 @@ const fail = (message) => {
94
94
  defaultMessage: 'Test failed intentionally',
95
95
  hideDiff: true,
96
96
  });
97
+ process.exit(1);
97
98
  };
98
99
  function doesNotThrow(block, errorOrMessage, message) {
99
100
  (0, assert_js_1.processAssert)(() => {
@@ -24,7 +24,7 @@ export declare const assertPromise: ((value: unknown, message?: ProcessAssertion
24
24
  notDeepStrictEqual: (actual: unknown, expected: unknown, message?: ProcessAssertionOptions["message"]) => Promise<void>;
25
25
  match: (value: string, regExp: RegExp, message?: ProcessAssertionOptions["message"]) => Promise<void>;
26
26
  ifError: (value: unknown, message?: ProcessAssertionOptions["message"]) => Promise<void>;
27
- fail: (message?: ProcessAssertionOptions["message"]) => Promise<void>;
27
+ fail: (message?: ProcessAssertionOptions["message"]) => Promise<never>;
28
28
  rejects: typeof rejects;
29
29
  };
30
30
  export {};
@@ -100,6 +100,7 @@ const fail = (message) => __awaiter(void 0, void 0, void 0, function* () {
100
100
  defaultMessage: 'Test failed intentionally',
101
101
  hideDiff: true,
102
102
  });
103
+ process.exit(1);
103
104
  });
104
105
  function doesNotThrow(block, errorOrMessage, message) {
105
106
  return __awaiter(this, void 0, void 0, function* () {
@@ -20,7 +20,7 @@ const exit = (code, quiet) => {
20
20
  write_js_1.Write.log(` ${(0, format_js_1.format)('Duration โ€บ').dim()} ${(0, format_js_1.format)(`${files_js_1.finalResults.time}ms`).bold().dim()} ${(0, format_js_1.format)(`(ยฑ${(0, time_js_1.parseTimeToSecs)(files_js_1.finalResults.time)} seconds)`).dim()}`);
21
21
  write_js_1.Write.log(` ${(0, format_js_1.format)(`Test Files โ€บ ${(0, format_js_1.format)(String(files_js_1.fileResults.success.size + files_js_1.fileResults.fail.size)).bold()}`).dim()}`);
22
22
  write_js_1.Write.hr();
23
- write_js_1.Write.log(`${(0, format_js_1.format)(` PASS โ€บ ${poku_js_1.results.success} `).bg('green')} ${(0, format_js_1.format)(` FAIL โ€บ ${poku_js_1.results.fail} `).bg(poku_js_1.results.fail === 0 ? 'grey' : 'red')}`);
23
+ write_js_1.Write.log(`${(0, format_js_1.format)(` PASS โ€บ ${poku_js_1.results.success - poku_js_1.results.skipped} `).bg('green')} ${(0, format_js_1.format)(` FAIL โ€บ ${poku_js_1.results.fail} `).bg(poku_js_1.results.fail === 0 ? 'grey' : 'red')} ${poku_js_1.results.skipped > 0 ? (0, format_js_1.format)(` SKIPPED โ€บ ${poku_js_1.results.skipped} `).bg(poku_js_1.results.skipped === 0 ? 'grey' : 'blue') : ''}`);
24
24
  write_js_1.Write.hr();
25
25
  }
26
26
  write_js_1.Write.log(`${(0, format_js_1.format)('Exited with code').dim()} ${(0, format_js_1.format)(String(code)).bold()[code === 0 ? 'success' : 'fail']()}\n`);
@@ -0,0 +1 @@
1
+ export declare const skip: (message?: string) => never;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.skip = 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 skip = (message) => {
8
+ const isPoku = typeof (node_process_1.env === null || node_process_1.env === void 0 ? void 0 : node_process_1.env.FILE) === 'string' && (node_process_1.env === null || node_process_1.env === void 0 ? void 0 : node_process_1.env.FILE.length) > 0;
9
+ const FILE = node_process_1.env.FILE;
10
+ if (message) {
11
+ write_js_1.Write.log((0, format_js_1.format)(isPoku
12
+ ? `โ„น ${message} ${(0, format_js_1.format)('โ€บ').dim()} ${(0, format_js_1.format)(`${FILE}`).italic().gray().dim()}`
13
+ : `โ„น ${message}`)
14
+ .info()
15
+ .bold());
16
+ }
17
+ (0, node_process_1.exit)(0);
18
+ };
19
+ exports.skip = skip;
@@ -52,7 +52,6 @@ const waitForExpectedResult = (callback, expectedResult, options) => __awaiter(v
52
52
  /* c8 ignore stop */
53
53
  yield (0, exports.sleep)(delay);
54
54
  const startTime = Date.now();
55
- // eslint-disable-next-line no-constant-condition
56
55
  while (true) {
57
56
  const result = yield callback();
58
57
  if (typeof expectedResult === 'function') {
@@ -3,6 +3,7 @@ export { assert } from './essentials/assert.js';
3
3
  export { test } from './helpers/test.js';
4
4
  export { describe } from './helpers/describe.js';
5
5
  export { it } from './helpers/it.js';
6
+ export { skip } from './helpers/skip.js';
6
7
  export { beforeEach, afterEach } from './helpers/each.js';
7
8
  export { docker } from './helpers/container.js';
8
9
  export { startScript, startService } from './helpers/create-service.js';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assertPromise = exports.listFiles = exports.log = exports.exit = exports.getPIDs = exports.kill = exports.sleep = exports.waitForPort = exports.waitForExpectedResult = exports.startService = exports.startScript = exports.docker = exports.afterEach = exports.beforeEach = exports.it = exports.describe = exports.test = exports.assert = exports.poku = void 0;
3
+ exports.assertPromise = exports.listFiles = exports.log = exports.exit = exports.getPIDs = exports.kill = exports.sleep = exports.waitForPort = exports.waitForExpectedResult = exports.startService = exports.startScript = exports.docker = exports.afterEach = exports.beforeEach = exports.skip = exports.it = exports.describe = exports.test = exports.assert = exports.poku = void 0;
4
4
  var poku_js_1 = require("./essentials/poku.js");
5
5
  Object.defineProperty(exports, "poku", { enumerable: true, get: function () { return poku_js_1.poku; } });
6
6
  var assert_js_1 = require("./essentials/assert.js");
@@ -11,6 +11,8 @@ var describe_js_1 = require("./helpers/describe.js");
11
11
  Object.defineProperty(exports, "describe", { enumerable: true, get: function () { return describe_js_1.describe; } });
12
12
  var it_js_1 = require("./helpers/it.js");
13
13
  Object.defineProperty(exports, "it", { enumerable: true, get: function () { return it_js_1.it; } });
14
+ var skip_js_1 = require("./helpers/skip.js");
15
+ Object.defineProperty(exports, "skip", { enumerable: true, get: function () { return skip_js_1.skip; } });
14
16
  var each_js_1 = require("./helpers/each.js");
15
17
  Object.defineProperty(exports, "beforeEach", { enumerable: true, get: function () { return each_js_1.beforeEach; } });
16
18
  Object.defineProperty(exports, "afterEach", { enumerable: true, get: function () { return each_js_1.afterEach; } });
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parserOutput = exports.isDebug = exports.isQuiet = void 0;
4
+ const poku_js_1 = require("../configs/poku.js");
4
5
  const regex = {
5
6
  newLine: /\n/,
6
7
  ansi: /u001b\[0m|\n/i,
8
+ skipped: /^"\\u001b\[94m\\u001b\[1mโ„น/i,
7
9
  };
8
10
  const isQuiet = (configs) => typeof (configs === null || configs === void 0 ? void 0 : configs.quiet) === 'boolean' && Boolean(configs === null || configs === void 0 ? void 0 : configs.quiet);
9
11
  exports.isQuiet = isQuiet;
@@ -13,6 +15,10 @@ exports.isDebug = isDebug;
13
15
  /* c8 ignore next */ // ?
14
16
  const parserOutput = (options) => {
15
17
  const { output, result, configs } = options;
18
+ const normalizedOutput = JSON.stringify(output);
19
+ if (regex.skipped.test(normalizedOutput)) {
20
+ ++poku_js_1.results.skipped;
21
+ }
16
22
  const debug = (0, exports.isDebug)(configs);
17
23
  const pad = (configs === null || configs === void 0 ? void 0 : configs.parallel) ? ' ' : ' ';
18
24
  const splittedOutput = output.split(regex.newLine);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poku",
3
- "version": "1.21.0",
3
+ "version": "1.22.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",
@@ -26,7 +26,7 @@
26
26
  "node": ">=6.0.0",
27
27
  "bun": ">=1.0.0",
28
28
  "deno": ">=1.30.0",
29
- "typescript": ">=5.0.2"
29
+ "typescript": ">=4.7.2"
30
30
  },
31
31
  "scripts": {
32
32
  "test": "npm run test:parallel && npm run test:sequential",
@@ -63,7 +63,7 @@
63
63
  "c8": "^10.1.2",
64
64
  "packages-update": "^2.0.0",
65
65
  "shx": "^0.3.4",
66
- "tsx": "4.16.0",
66
+ "tsx": "4.16.2",
67
67
  "typescript": "^5.5.3"
68
68
  },
69
69
  "keywords": [