poku 1.22.0 โ†’ 1.23.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
@@ -10,11 +10,11 @@ Enjoying **Poku**? Give him a star to show your support ๐ŸŒŸ
10
10
  [![License](https://img.shields.io/npm/l/poku?maxAge=2592000&color=9c88ff)](https://github.com/wellwelwel/poku/blob/main/LICENSE)<br />
11
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
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)
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=iterm2&logoColor=white)](https://github.com/wellwelwel/poku/actions/workflows/ci_coverage-windows.yml?query=branch%3Amain)
14
14
 
15
15
  ---
16
16
 
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)
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,35 +22,32 @@ 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#javascript-essence-for-tests-), 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.
26
26
 
27
- <img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> No configurations<br />
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 />
29
29
  <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"> Run the same test suite for [**Node.js**][node-version-url], [**Bun**][bun-version-url], and [**Deno**][deno-version-url]<br />
30
30
 
31
- <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 />
32
- <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"> [**Node.js**][node-version-url] familiar **API**<br />
33
- <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"> Instantly re-run related tests in `watch` mode<br />
31
+ <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 />
34
32
  <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"> Run **CJS** (**CommonJS**) files directly with [**Deno**][deno-version-url]<br />
35
- <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"> Easily handle **containers**, **servers**, **services**, **processes**, and **ports**<br />
33
+ <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"> Easily handle **containers**, **servers**, **processes**, and **ports**<br />
36
34
 
37
- <img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Safety and Reliability<br />
35
+ <img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> _Safety and Reliability_<br />
38
36
  <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"> High **isolation** level per file<br />
39
37
  <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"> **Performant** and **lightweight**<br />
40
- <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"> Compatible with **coverage** tools
41
38
 
42
39
  ---
43
40
 
44
41
  ## Quickstart
45
42
 
46
- ### Install
43
+ ### <img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Install
47
44
 
48
45
  <table>
49
46
  <tr>
50
- <td><blockquote><b>Node.js</b</blockquote></td>
51
- <td><blockquote><b>TypeScript + Node.js</b</blockquote></td>
52
- <td><blockquote><b>Bun</b</blockquote></td>
53
- <td><blockquote><b>Deno</b</blockquote></td>
47
+ <td><blockquote><i>Node.js</i></blockquote></td>
48
+ <td><blockquote><i>TypeScript (Node.js)</i></blockquote></td>
49
+ <td><blockquote><i>Bun</i></blockquote></td>
50
+ <td><blockquote><i>Deno</i></blockquote></td>
54
51
  </tr>
55
52
  <tr>
56
53
  <td width="400">
@@ -84,7 +81,9 @@ deno add npm:poku
84
81
  </tr>
85
82
  </table>
86
83
 
87
- ### Test
84
+ ---
85
+
86
+ ### <img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Test
88
87
 
89
88
  <table>
90
89
  <tr>
@@ -105,13 +104,15 @@ assert(true, 'Poku will describe it ๐Ÿท');
105
104
  </tr>
106
105
  </table>
107
106
 
108
- ### Run
107
+ ---
108
+
109
+ ### <img width="16" height="16" alt="check" src="https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/check.svg"> Run
109
110
 
110
111
  <table>
111
112
  <tr>
112
- <td><blockquote><b>Node.js (and TypeScript)</b</blockquote></td>
113
- <td><blockquote><b>Bun</b</blockquote></td>
114
- <td><blockquote><b>Deno</b</blockquote></td>
113
+ <td><blockquote><i>Node.js (and TypeScript)</i></blockquote></td>
114
+ <td><blockquote><i>Bun</i></blockquote></td>
115
+ <td><blockquote><i>Deno</i></blockquote></td>
115
116
  </tr>
116
117
  <tr>
117
118
  <td width="400">
@@ -138,36 +139,100 @@ deno run npm:poku
138
139
  </tr>
139
140
  </table>
140
141
 
141
- > Try the flag `--parallel` to run tests in parallel.
142
-
143
- - That's it ๐ŸŽ‰
144
-
145
142
  ---
146
143
 
147
- ## Available Methods
144
+ ## Features
148
145
 
149
146
  ### Essentials
150
147
 
151
- - [**poku**](https://poku.io/docs/category/-poku) _(test runner)_
152
- - [**assert**](https://poku.io/docs/documentation/assert) _(test assertion)_
148
+ <table>
149
+ <tr>
150
+ <th width="250">Name</th>
151
+ <th width="800">Description</th>
152
+ </tr>
153
+ <tr>
154
+ <td><a href="https://poku.io/docs/category/-poku">poku</a></td>
155
+ <td>๐Ÿงช Test runner.</td>
156
+ </tr>
157
+ <tr>
158
+ <td><a href="https://poku.io/docs/documentation/assert">assert</a></td>
159
+ <td>๐Ÿ”ฌ Test assertion <i>(<strong>Node.js</strong> familiar <strong>API</strong>)</i>.</td>
160
+ </tr>
161
+ </table>
153
162
 
154
163
  ### Helpers
155
164
 
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
- - [**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)_
158
- - [**docker**](https://poku.io/docs/documentation/helpers/containers) _(build, start, compose, stop, remove, and test containers)_
159
- - [**startScript**](https://poku.io/docs/documentation/helpers/startScript) _(run **package.json** scripts in background)_
160
- - [**startService**](https://poku.io/docs/documentation/helpers/startService) _(run files in background)_
161
- - [**kill**](https://poku.io/docs/documentation/helpers/processes/kill) _(terminate ports, port ranges, and PIDs)_
162
- - [**waitForPort**](https://poku.io/docs/documentation/helpers/processes/wait-for-port) _(wait for specified ports to become active)_
163
- - [**waitForExpectedResult**](https://poku.io/docs/documentation/helpers/processes/wait-for-expected-result) _(retry until an expected result or times out)_
164
- - [**getPIDs**](https://poku.io/docs/documentation/helpers/processes/get-pids) _(debug processes IDs using ports and port ranges)_
165
+ <table>
166
+ <tr>
167
+ <th width="250">Name</th>
168
+ <th width="800">Description</th>
169
+ </tr>
170
+ <tr>
171
+ <td><a href="https://poku.io/docs/documentation/helpers/test">test</a> โ€ข <a href="https://poku.io/docs/documentation/helpers/describe">describe</a> โ€ข <a href="https://poku.io/docs/documentation/helpers/it">it</a></td>
172
+ <td>๐Ÿคน๐Ÿปโ€โ™€๏ธ Organize, group, and isolate tests.</td>
173
+ </tr>
174
+ <tr>
175
+ <td><a href="https://poku.io/docs/documentation/helpers/env">envFile</a></td>
176
+ <td>โš™๏ธ Process an environment file <i>(out-of-box)</i>.</td>
177
+ </tr>
178
+ <tr>
179
+ <td><a href="https://poku.io/docs/category/-before-and-after-each">beforeEach</a> โ€ข <a href="https://poku.io/docs/category/-before-and-after-each">afterEach</a></td>
180
+ <td>๐Ÿƒ Hooks for test setup and teardown.</td>
181
+ </tr>
182
+ <tr>
183
+ <td><a href="https://poku.io/docs/documentation/helpers/startScript">startScript</a></td>
184
+ <td>๐ŸŒ Run package.json scripts in background.</td>
185
+ </tr>
186
+ <tr>
187
+ <td><a href="https://poku.io/docs/documentation/helpers/startService">startService</a></td>
188
+ <td>๐ŸŒ Run files in background.</td>
189
+ </tr>
190
+ <tr>
191
+ <td><a href="https://poku.io/docs/documentation/helpers/containers">docker</a></td>
192
+ <td>๐Ÿณ Build, start, compose, stop, remove, and test containers.</td>
193
+ </tr>
194
+ <tr>
195
+ <td><a href="https://poku.io/docs/documentation/helpers/processes/kill">kill</a></td>
196
+ <td>๐Ÿ”Œ Terminate ports, port ranges, and PIDs.</td>
197
+ </tr>
198
+ <tr>
199
+ <td><a href="https://poku.io/docs/documentation/helpers/processes/wait-for-port">waitForPort</a></td>
200
+ <td>๐Ÿ˜ด Wait for specified ports to become active.</td>
201
+ </tr>
202
+ <tr>
203
+ <td><a href="https://poku.io/docs/documentation/helpers/processes/wait-for-expected-result">waitForExpectedResult</a></td>
204
+ <td>๐Ÿฅฑ Retry until an expected result or times out.</td>
205
+ </tr>
206
+ <tr>
207
+ <td><a href="https://poku.io/docs/documentation/helpers/skip">skip</a></td>
208
+ <td>โญ๏ธ Skip tests when necessary.</td>
209
+ </tr>
210
+ <tr>
211
+ <td><a href="https://poku.io/docs/documentation/helpers/processes/get-pids">getPIDs</a></td>
212
+ <td>๐Ÿ•ต๐Ÿป Debug processes IDs using ports and port ranges.</td>
213
+ </tr>
214
+ </table>
165
215
 
166
216
  ### Common Options
167
217
 
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)_
218
+ <table>
219
+ <tr>
220
+ <th width="250">Name</th>
221
+ <th width="800">Description</th>
222
+ </tr>
223
+ <tr>
224
+ <td><a href="https://poku.io/docs/documentation/poku/options/watch">watch</a></td>
225
+ <td>๐Ÿฟ Watch for changes and re-run related test files.</td>
226
+ </tr>
227
+ <tr>
228
+ <td><a href="https://poku.io/docs/documentation/poku/options/parallel">parallel</a></td>
229
+ <td>๐Ÿƒ๐Ÿปโ€โ™€๏ธ Run tests in parallel.</td>
230
+ </tr>
231
+ <tr>
232
+ <td><a href="https://poku.io/docs/documentation/poku/options/debug">debug</a></td>
233
+ <td>๐Ÿ•ต๐Ÿป Shows all logs.</td>
234
+ </tr>
235
+ </table>
171
236
 
172
237
  > _and much more_ ๐Ÿ‘‡๐Ÿป
173
238
 
package/lib/bin/index.js CHANGED
@@ -12,6 +12,7 @@ const files_js_1 = require("../configs/files.js");
12
12
  const get_runtime_js_1 = require("../parsers/get-runtime.js");
13
13
  const format_js_1 = require("../services/format.js");
14
14
  const kill_js_1 = require("../modules/helpers/kill.js");
15
+ const env_js_1 = require("../modules/helpers/env.js");
15
16
  const map_tests_js_1 = require("../services/map-tests.js");
16
17
  const watch_js_1 = require("../services/watch.js");
17
18
  const poku_js_1 = require("../modules/essentials/poku.js");
@@ -41,6 +42,7 @@ const quiet = (0, get_arg_js_1.hasArg)('quiet');
41
42
  const debug = (0, get_arg_js_1.hasArg)('debug');
42
43
  const failFast = (0, get_arg_js_1.hasArg)('fail-fast');
43
44
  const watchMode = (0, get_arg_js_1.hasArg)('watch');
45
+ const hasEnvFile = (0, get_arg_js_1.hasArg)('env-file');
44
46
  const concurrency = parallel
45
47
  ? Number((0, get_arg_js_1.getArg)('concurrency')) || undefined
46
48
  : undefined;
@@ -62,6 +64,10 @@ if (killPID) {
62
64
  const PIDs = killPID.split(',').map(Number);
63
65
  tasks.push(kill_js_1.kill.pid(PIDs));
64
66
  }
67
+ if (hasEnvFile) {
68
+ const envFilePath = (0, get_arg_js_1.getArg)('env-file');
69
+ tasks.push((0, env_js_1.envFile)(envFilePath));
70
+ }
65
71
  const options = {
66
72
  platform: (0, get_runtime_js_1.platformIsValid)(platform) ? platform : undefined,
67
73
  filter: filter ? new RegExp((0, list_files_js_1.escapeRegExp)(filter)) : undefined,
@@ -0,0 +1,2 @@
1
+ /** Reads an environment file and sets the environment variables. */
2
+ export declare const envFile: (filePath?: string) => Promise<void>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.envFile = void 0;
13
+ /* c8 ignore start */ // ?
14
+ const fs_js_1 = require("../../polyfills/fs.js");
15
+ const list_files_js_1 = require("./list-files.js");
16
+ const env_js_1 = require("../../services/env.js");
17
+ const regex = {
18
+ comment: /^\s*#/,
19
+ };
20
+ /** Reads an environment file and sets the environment variables. */
21
+ const envFile = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (filePath = '.env') {
22
+ /* c8 ignore stop */
23
+ const mapEnv = new Map();
24
+ const env = yield (0, fs_js_1.readFile)((0, list_files_js_1.sanitizePath)(filePath), 'utf8');
25
+ const lines = env
26
+ .split('\n')
27
+ .map((line) => (0, env_js_1.removeComments)(line.trim()))
28
+ .filter((line) => line.length > 0 && !regex.comment.test(line));
29
+ for (const line of lines) {
30
+ const parsedLine = (0, env_js_1.parseEnvLine)(line);
31
+ if (parsedLine) {
32
+ const { arg, value } = parsedLine;
33
+ mapEnv.set(arg, value ? (0, env_js_1.resolveEnvVariables)(value, process.env) : value);
34
+ }
35
+ }
36
+ for (const [arg, value] of mapEnv) {
37
+ process.env[arg] = value;
38
+ }
39
+ });
40
+ exports.envFile = envFile;
@@ -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 { envFile } from './helpers/env.js';
6
7
  export { skip } from './helpers/skip.js';
7
8
  export { beforeEach, afterEach } from './helpers/each.js';
8
9
  export { docker } from './helpers/container.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.skip = 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.envFile = 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 env_js_1 = require("./helpers/env.js");
15
+ Object.defineProperty(exports, "envFile", { enumerable: true, get: function () { return env_js_1.envFile; } });
14
16
  var skip_js_1 = require("./helpers/skip.js");
15
17
  Object.defineProperty(exports, "skip", { enumerable: true, get: function () { return skip_js_1.skip; } });
16
18
  var each_js_1 = require("./helpers/each.js");
@@ -0,0 +1,6 @@
1
+ export declare const removeComments: (input: string) => string;
2
+ export declare const parseEnvLine: (line: string) => {
3
+ arg: string;
4
+ value: string;
5
+ } | null;
6
+ export declare const resolveEnvVariables: (str: string, env: typeof process.env) => string;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveEnvVariables = exports.parseEnvLine = exports.removeComments = void 0;
4
+ /* c8 ignore next */ // ?
5
+ const removeComments = (input) => {
6
+ let output = '';
7
+ let quoteChar = '';
8
+ let inQuote = false;
9
+ for (let i = 0; i < input.length; i++) {
10
+ const char = input[i];
11
+ if (inQuote) {
12
+ output += char;
13
+ if (char === quoteChar && input[i - 1] !== '\\') {
14
+ inQuote = false;
15
+ }
16
+ }
17
+ else if (char === '"' || char === "'") {
18
+ inQuote = true;
19
+ quoteChar = char;
20
+ output += char;
21
+ }
22
+ else if (char === '#') {
23
+ break;
24
+ }
25
+ else {
26
+ output += char;
27
+ }
28
+ }
29
+ return output.trim();
30
+ };
31
+ exports.removeComments = removeComments;
32
+ /* c8 ignore net */ // ?
33
+ const parseEnvLine = (line) => {
34
+ const index = line.indexOf('=');
35
+ if (index === -1) {
36
+ return null;
37
+ }
38
+ const arg = line.substring(0, index).trim();
39
+ const value = line
40
+ .substring(index + 1)
41
+ .trim()
42
+ .replace(/^['"]|['"]$/g, '');
43
+ return { arg, value };
44
+ };
45
+ exports.parseEnvLine = parseEnvLine;
46
+ /* c8 ignore next */ // ?
47
+ const resolveEnvVariables = (str, env) => {
48
+ let result = '';
49
+ let i = 0;
50
+ while (i < str.length) {
51
+ if (str[i] === '$' && str[i + 1] === '{') {
52
+ i += 2;
53
+ let varName = '';
54
+ while (i < str.length && str[i] !== '}') {
55
+ varName += str[i];
56
+ i++;
57
+ }
58
+ i++;
59
+ result += env[varName] || '';
60
+ }
61
+ else {
62
+ result += str[i];
63
+ i++;
64
+ }
65
+ }
66
+ return result;
67
+ };
68
+ exports.resolveEnvVariables = resolveEnvVariables;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poku",
3
- "version": "1.22.0",
3
+ "version": "1.23.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",
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "devDependencies": {
61
61
  "@biomejs/biome": "1.8.3",
62
- "@types/node": "^20.14.9",
62
+ "@types/node": "^20.14.10",
63
63
  "c8": "^10.1.2",
64
64
  "packages-update": "^2.0.0",
65
65
  "shx": "^0.3.4",
@@ -74,18 +74,10 @@
74
74
  "assertion",
75
75
  "testing",
76
76
  "node",
77
- "nodejs",
78
77
  "bun",
79
78
  "deno",
80
79
  "typescript",
81
80
  "tsx",
82
- "concurrent",
83
- "concurrency",
84
- "parallel",
85
- "parallelism",
86
- "sequential",
87
- "queue",
88
- "queuing",
89
81
  "run",
90
82
  "cli",
91
83
  "unit",
@@ -94,8 +86,6 @@
94
86
  "end-to-end",
95
87
  "tdd",
96
88
  "bdd",
97
- "isolate",
98
- "isolation",
99
89
  "watch",
100
90
  "jest",
101
91
  "mocha",
@@ -106,12 +96,13 @@
106
96
  "tap",
107
97
  "tape",
108
98
  "karma",
109
- "urun",
110
99
  "supertest",
100
+ "dotenv",
111
101
  "filter",
112
102
  "exclude",
113
103
  "list",
114
104
  "files",
105
+ "env",
115
106
  "kill",
116
107
  "container",
117
108
  "process",
@@ -122,11 +113,9 @@
122
113
  "esmodules",
123
114
  "esm",
124
115
  "mjs",
125
- "expect",
126
116
  "framework",
127
117
  "tool",
128
118
  "runtime",
129
- "poku",
130
- "pokujs"
119
+ "poku"
131
120
  ]
132
121
  }