Comparing version 1.16.0 to 1.17.0
@@ -21,2 +21,3 @@ #! /usr/bin/env node | ||
const hr_js_1 = require("../helpers/hr.js"); | ||
const map_tests_js_1 = require("../services/map-tests.js"); | ||
const watch_js_1 = require("../services/watch.js"); | ||
@@ -99,6 +100,28 @@ const poku_js_1 = require("../modules/poku.js"); | ||
const interval = Number((0, get_arg_js_1.getArg)('watch-interval')) || 1500; | ||
files_js_1.fileResults.success.clear(); | ||
files_js_1.fileResults.fail.clear(); | ||
(0, hr_js_1.hr)(); | ||
(0, logs_js_1.write)(`Watching: ${dirs.join(', ')}`); | ||
const resultsClear = () => { | ||
files_js_1.fileResults.success.clear(); | ||
files_js_1.fileResults.fail.clear(); | ||
}; | ||
resultsClear(); | ||
(0, map_tests_js_1.mapTests)('.', dirs).then((mappedTests) => [ | ||
Array.from(mappedTests.keys()).forEach((mappedTest) => { | ||
(0, watch_js_1.watch)(mappedTest, (file, event) => { | ||
if (event === 'change') { | ||
const filePath = (0, map_tests_js_1.normalizePath)(file); | ||
if (executing.has(filePath)) | ||
return; | ||
executing.add(filePath); | ||
resultsClear(); | ||
const tests = mappedTests.get(filePath); | ||
if (!tests) | ||
return; | ||
(0, poku_js_1.poku)(tests, options).then(() => { | ||
setTimeout(() => { | ||
executing.delete(filePath); | ||
}, interval); | ||
}); | ||
} | ||
}); | ||
}), | ||
]); | ||
dirs.forEach((dir) => { | ||
@@ -110,4 +133,3 @@ (0, watch_js_1.watch)(dir, (file, event) => { | ||
executing.add(file); | ||
files_js_1.fileResults.success.clear(); | ||
files_js_1.fileResults.fail.clear(); | ||
resultsClear(); | ||
(0, poku_js_1.poku)(file, options).then(() => { | ||
@@ -121,4 +143,6 @@ setTimeout(() => { | ||
}); | ||
(0, hr_js_1.hr)(); | ||
(0, logs_js_1.write)(`Watching: ${dirs.join(', ')}`); | ||
} | ||
}))(); | ||
/* c8 ignore stop */ |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { type Dirent, type Stats } from 'node:fs'; | ||
@@ -7,1 +8,2 @@ export declare const readdir: (path: string, options: { | ||
export declare const stat: (path: string) => Promise<Stats>; | ||
export declare const readFile: (path: string, encoding?: BufferEncoding) => Promise<string>; |
"use strict"; | ||
/* c8 ignore start */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.stat = exports.readdir = void 0; | ||
exports.readFile = exports.stat = exports.readdir = void 0; | ||
const node_fs_1 = require("fs"); | ||
@@ -26,2 +26,11 @@ const readdir = (path, options) => new Promise((resolve, reject) => { | ||
exports.stat = stat; | ||
const readFile = (path, encoding = 'utf-8') => new Promise((resolve, reject) => { | ||
(0, node_fs_1.readFile)(path, encoding, (err, data) => { | ||
if (err) | ||
reject(err); | ||
else | ||
resolve(data); | ||
}); | ||
}); | ||
exports.readFile = readFile; | ||
/* c8 ignore stop */ |
{ | ||
"name": "poku", | ||
"version": "1.16.0", | ||
"version": "1.17.0", | ||
"description": "๐ท Poku makes testing easy for Node.js, Bun, Deno and you at the same time.", | ||
@@ -73,2 +73,3 @@ "main": "./lib/index.js", | ||
"queuing", | ||
"watch", | ||
"nodejs", | ||
@@ -75,0 +76,0 @@ "node", |
@@ -21,7 +21,7 @@ [node-version-url]: https://github.com/nodejs/node | ||
<div align="center"> | ||
<img width="170" height="170" alt="Logo" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/poku.svg"> | ||
<img width="125" height="125" alt="Logo" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/poku.svg"> | ||
# Poku | ||
**Poku** can show you _how simple testing can be_ ๐ฑ | ||
Enjoying **Poku**? Give him a star to show your support ๐ | ||
@@ -35,4 +35,2 @@ [![NPM Downloads][downloads-image]][downloads-url] | ||
Enjoying **Poku**? Give him a star to show your support โญ๏ธ | ||
</div> | ||
@@ -44,3 +42,3 @@ | ||
> **Poku** takes on the testers' difficulties by itself and lets you focus on the tests. | ||
**Poku** makes testing easy and takes on the testers' difficulties to _let you focus on your tests_: | ||
@@ -50,17 +48,16 @@ <img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> No configurations<br /> | ||
<span> </span><img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Auto detect **Typescript** files<br /> | ||
<span> </span><img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Run the same test suite for [**Node.js**][node-version-url], [**Bun**][bun-version-url] and [**Deno**][deno-version-url]<br /> | ||
<span> </span><img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Run the same test suite for [**Node.js**][node-version-url] _(6+)_, [**Bun**][bun-version-url] and [**Deno**][deno-version-url]<br /> | ||
<img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Easier and Less Verbose<br /> | ||
<span> </span><img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> [**Node.js**][node-version-url] familiar **API**<br /> | ||
<span> </span><img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Easily test your server just by running it ๐<br /> | ||
<span> </span><img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Run **CJS** (**CommonJS**) files directly with [**Deno**][deno-version-url]<br /> | ||
<span> </span><img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Easily handle **services**, **servers**, **processes** and **ports**<br /> | ||
<span> </span><img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Easily handle, **servers**, **services**, **processes**, and **ports**<br /> | ||
<img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Safety and Reliability<br /> | ||
<span> </span><img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> High **isolation** level per file<br /> | ||
<span> </span><img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Performant and lightweight<br /> | ||
<span> </span><img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Compatible with **Coverage** tools<br /> | ||
<span> </span><img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> **Poku** doesn't use `eval` nor global state ๐<br /> | ||
<span> </span><span> </span><img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> _In other words, you can run your tests directly, without relying on **Poku**_<br /> | ||
<span> </span><img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> **Performant** and **lightweight**<br /> | ||
<span> </span><img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Compatible with **coverage** tools | ||
> ๐ก **Poku** brings the [essence of **JavaScript** back to testing](https://poku.io/docs/philosophy), allowing to use your knowledge to create tests intuitively. | ||
--- | ||
@@ -72,4 +69,2 @@ | ||
[![Install Size](https://packagephobia.com/badge?p=poku)](https://packagephobia.com/result?p=poku) | ||
<table> | ||
@@ -168,3 +163,3 @@ <tr> | ||
That's it ๐ | ||
- That's it ๐ | ||
@@ -181,8 +176,4 @@ --- | ||
- **Test** | ||
- [**poku**](https://poku.io/docs/category/poku) (_test runner_) | ||
- [**assert**](https://poku.io/docs/documentation/assert) (_test assertion_) | ||
- **Background Services** | ||
- [**startScript**](https://poku.io/docs/documentation/startScript) (_run `package.json` scripts in a background process_) | ||
- [**startService**](https://poku.io/docs/documentation/startService) (_run files in a background process_) | ||
- [**poku**](https://poku.io/docs/category/poku) _(test runner)_ | ||
- [**assert**](https://poku.io/docs/documentation/assert) _(test assertion)_ | ||
@@ -192,9 +183,10 @@ ### Helpers | ||
- [**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) | ||
- [**beforeEach**](https://poku.io/docs/category/beforeeach-and-aftereach) and [**afterEach**](https://poku.io/docs/category/beforeeach-and-aftereach) | ||
- [**watch**](https://poku.io/docs/documentation/poku/options/watch) | ||
- **Processes** | ||
- [**kill**](https://poku.io/docs/documentation/processes/kill) (_terminate Ports, Port Ranges and PIDs_) | ||
- [**getPIDs**](https://poku.io/docs/documentation/processes/get-pids) (_get all processes IDs using ports and port ranges_) | ||
- _and much more_ โจ | ||
, [**describe**](https://poku.io/docs/documentation/helpers/describe) and [**it**](https://poku.io/docs/documentation/helpers/it) _(organize, group, and isolate tests)_ | ||
- [**beforeEach**](https://poku.io/docs/category/beforeeach-and-aftereach) and [**afterEach**](https://poku.io/docs/category/beforeeach-and-aftereach) _(hooks for test setup and teardown)_ | ||
- [**watch**](https://poku.io/docs/documentation/poku/options/watch) _(watch test files for changes)_ | ||
- [**startScript**](https://poku.io/docs/documentation/startScript) _(run **package.json** scripts in background)_ | ||
- [**startService**](https://poku.io/docs/documentation/startService) _(run files in background)_ | ||
- [**kill**](https://poku.io/docs/documentation/processes/kill) _(terminate ports, port ranges, and PIDs)_ | ||
- [**getPIDs**](https://poku.io/docs/documentation/processes/get-pids) _(debug processes IDs using ports and port ranges)_ | ||
- _and much more_ ๐๐ป | ||
@@ -211,14 +203,6 @@ --- | ||
> I'm continuously working to improve **Poku**. If you've got something interesting to share, feel free to submit a [**Pull Request**](https://github.com/wellwelwel/poku/compare). If you notice something wrong, I'd appreciate if you'd open an [**Issue**](https://github.com/wellwelwel/poku/issues/new). | ||
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) ๐ | ||
Please check the [**CONTRIBUTING.md**](./CONTRIBUTING.md) for instructions ๐ | ||
--- | ||
## Philosophy | ||
Please check the [**Philosophy**](https://poku.io/docs/philosophy) section from Documentation. | ||
--- | ||
## Security Policy | ||
@@ -228,3 +212,3 @@ | ||
Please check the [**SECURITY.md**](./SECURITY.md) and the section [**Is Poku Safe?**](https://poku.io/docs/security) from Documentation. | ||
Please check the [**SECURITY.md**](https://github.com/wellwelwel/poku/blob/main/SECURITY.md). | ||
@@ -237,7 +221,7 @@ --- | ||
**Poku** is continuously tested ([**CI**](https://github.com/wellwelwel/poku/blob/main/.github/workflows/ci_benchmark.yml)) to ensure the following expectations: | ||
**Poku** is [continuously tested](https://github.com/wellwelwel/poku/blob/main/.github/workflows/ci_benchmark.yml) to ensure the following expectations: | ||
- [x] **~4x** faster than [**Jest**](https://github.com/jestjs/jest) (v29.7.0) | ||
- [x] **~3x** faster than [**Vitest**](https://github.com/vitest-dev/vitest) (v1.6.0) | ||
- [x] **~1x** faster than [**Mocha**](https://github.com/mochajs/mocha) (v10.4.0) + [**Chai**](https://github.com/chaijs/chai) (v5.1.1) | ||
- **~4x** faster than [**Jest**](https://github.com/jestjs/jest) (v29.7.0) | ||
- **~3x** faster than [**Vitest**](https://github.com/vitest-dev/vitest) (v1.6.0) | ||
- **~1x** faster than [**Mocha**](https://github.com/mochajs/mocha) (v10.4.0) + [**Chai**](https://github.com/chaijs/chai) (v5.1.1) | ||
@@ -250,7 +234,7 @@ > You can see how the tests are run and compared in the [benchmark](https://github.com/wellwelwel/poku/tree/main/benchmark) directory. | ||
<a href="https://pkg-size.dev/poku"><img src="https://pkg-size.dev/badge/install/125875" title="Install size for poku"></a> | ||
[![Install Size](https://packagephobia.com/badge?p=poku)](https://pkg-size.dev/poku) | ||
- [x] [~**175x** lighter than **Jest**](https://pkg-size.dev/jest) | ||
- [x] [~**302x** lighter than **Vitest**](https://pkg-size.dev/vitest) | ||
- [x] [~**44x** lighter than **Mocha** + **Chai**](https://pkg-size.dev/mocha%20chai) | ||
- [~**300x** lighter than **Vitest**](https://pkg-size.dev/vitest) | ||
- [~**170x** lighter than **Jest**](https://pkg-size.dev/jest) | ||
- [~**40x** lighter than **Mocha** + **Chai**](https://pkg-size.dev/mocha%20chai) | ||
@@ -261,4 +245,4 @@ --- | ||
- **Poku** community is gradually building up ๐ค | ||
- Although it has no external dependencies, **Poku** is not _all-in-one_, so it doesn't have features such as _mocks_ and _spies_, where you can use your favorite packages or native solutions. | ||
- 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. | ||
- **Poku** community is gradually building up. | ||
@@ -277,2 +261,2 @@ --- | ||
Poku is under the [**MIT License**](./LICENSE). | ||
**Poku** is under the [**MIT License**](https://github.com/wellwelwel/poku/blob/main/LICENSE). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
152931
93
3196
249