poku 4.3.3-canary.7e1ba35c → 4.4.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/lib/modules/_shared.cjs +7 -13
- package/lib/modules/_shared.d.cts +14 -104
- package/lib/modules/_shared.d.ts +14 -104
- package/lib/modules/_shared.js +7 -13
- package/lib/modules/index.d.cts +5 -101
- package/lib/modules/index.d.ts +5 -101
- package/lib/modules/plugins.d.cts +0 -1
- package/lib/modules/plugins.d.ts +0 -1
- package/package.json +1 -1
package/lib/modules/_shared.cjs
CHANGED
|
@@ -447,7 +447,7 @@ const states = getSharedState("states", {
|
|
|
447
447
|
}), errorHoist = getSharedState("errorHoist", {
|
|
448
448
|
depth: 0,
|
|
449
449
|
failed: !1
|
|
450
|
-
}), VERSION = "4.
|
|
450
|
+
}), VERSION = "4.4.0", deepOptions = getSharedState("deepOptions", []), GLOBAL = getSharedState("GLOBAL", {
|
|
451
451
|
cwd: cwd$1,
|
|
452
452
|
configs: {
|
|
453
453
|
filter: void 0,
|
|
@@ -864,14 +864,12 @@ const poku = (async (targetPaths, configs) => {
|
|
|
864
864
|
if (typeof messageOrCb == "function") return itBase2(messageOrCb);
|
|
865
865
|
}), SCOPE_HOOKS_KEY = /* @__PURE__ */ Symbol.for("@pokujs/poku.test-scope-hooks"), getScopeHook = () => globalThis[SCOPE_HOOKS_KEY], itBase = async (titleOrCb, callback) => {
|
|
866
866
|
try {
|
|
867
|
-
const title = getTitle(titleOrCb), hasTitle = typeof title == "string", cb = getCallback(hasTitle ? callback : titleOrCb);
|
|
868
|
-
let success = !0, start, end;
|
|
867
|
+
const title = getTitle(titleOrCb), hasTitle = typeof title == "string", cb = getCallback(hasTitle ? callback : titleOrCb), insideDescribe = errorHoist.depth > 0;
|
|
868
|
+
let success = !0, start, end, onError;
|
|
869
869
|
if (GLOBAL.reporter.onItStart({ title }), hasTitle && indentation.itDepth++, typeof each.before.cb == "function") {
|
|
870
870
|
const beforeResult = each.before.cb();
|
|
871
871
|
beforeResult instanceof Promise && await beforeResult;
|
|
872
872
|
}
|
|
873
|
-
const insideDescribe = errorHoist.depth > 0;
|
|
874
|
-
let onError;
|
|
875
873
|
insideDescribe ? errorHoist.failed = !1 : (onError = (error) => {
|
|
876
874
|
const ctx = retryContext.stack?.[retryContext.stack.length - 1];
|
|
877
875
|
ctx ? ctx.failed = !0 : (process$1.exitCode = 1, success = !1, error instanceof nodeAssert.AssertionError || console.error(error));
|
|
@@ -1147,18 +1145,14 @@ const regex = {
|
|
|
1147
1145
|
}), killPID = async (PID) => {
|
|
1148
1146
|
const PIDs = setPortsAndPIDs(PID);
|
|
1149
1147
|
await Promise.all(
|
|
1150
|
-
PIDs.map(
|
|
1151
|
-
isWindows ?
|
|
1152
|
-
|
|
1148
|
+
PIDs.map(
|
|
1149
|
+
async (p) => isWindows ? killPID$1.windows(p) : killPID$1.unix(p)
|
|
1150
|
+
)
|
|
1153
1151
|
);
|
|
1154
1152
|
}, killPIDs = async (PIDs) => {
|
|
1155
1153
|
for (const PID of PIDs)
|
|
1156
1154
|
PID && await killPID(PID);
|
|
1157
|
-
}, killPort = async (port) => {
|
|
1158
|
-
await killPIDs(await getPIDs(port));
|
|
1159
|
-
}, killRange = async (startsAt, endsAt) => {
|
|
1160
|
-
await killPIDs(await getPIDs.range(startsAt, endsAt));
|
|
1161
|
-
}, kill = {
|
|
1155
|
+
}, killPort = async (port) => killPIDs(await getPIDs(port)), killRange = async (startsAt, endsAt) => killPIDs(await getPIDs.range(startsAt, endsAt)), kill = {
|
|
1162
1156
|
pid: killPID,
|
|
1163
1157
|
port: killPort,
|
|
1164
1158
|
range: killRange
|
|
@@ -4,17 +4,8 @@ import { ChildProcess, ChildProcessWithoutNullStreams } from 'node:child_process
|
|
|
4
4
|
type Code = 0 | 1;
|
|
5
5
|
|
|
6
6
|
type Configs$1 = {
|
|
7
|
-
/**
|
|
8
|
-
* Filter by path to match only the files that should be performed.
|
|
9
|
-
*
|
|
10
|
-
* @default /\.(test|spec)\./i
|
|
11
|
-
*/
|
|
7
|
+
/** @default /\.(test|spec)\./i */
|
|
12
8
|
filter?: RegExp;
|
|
13
|
-
/**
|
|
14
|
-
* Exclude by path to match only the files that should be performed.
|
|
15
|
-
*
|
|
16
|
-
* @default undefined
|
|
17
|
-
*/
|
|
18
9
|
exclude?: RegExp | RegExp[];
|
|
19
10
|
};
|
|
20
11
|
|
|
@@ -92,9 +83,8 @@ type PluginContext = {
|
|
|
92
83
|
readonly reporter: ReturnType<ReporterPlugin>;
|
|
93
84
|
};
|
|
94
85
|
type PokuPlugin = {
|
|
95
|
-
/** Plugin name */
|
|
96
86
|
name?: string;
|
|
97
|
-
/** Modify the command
|
|
87
|
+
/** Modify the command before spawning a test file process */
|
|
98
88
|
runner?: (command: string[], file: string) => string[];
|
|
99
89
|
/** Run before the test suite begins */
|
|
100
90
|
setup?: (context: PluginContext) => void | Promise<void>;
|
|
@@ -198,104 +188,30 @@ type DenoOptions = {
|
|
|
198
188
|
type Runtime = 'node' | 'bun' | 'deno';
|
|
199
189
|
type Reporter = 'poku' | 'focus' | 'dot' | 'compact' | 'classic' | ReporterPlugin | CustomString;
|
|
200
190
|
type Configs = {
|
|
201
|
-
/**
|
|
202
|
-
* By setting `true`, **Poku** won't exit the process and will return the exit code (`0` or `1`)
|
|
203
|
-
*
|
|
204
|
-
* @default false
|
|
205
|
-
*/
|
|
206
|
-
noExit?: boolean;
|
|
207
|
-
/**
|
|
208
|
-
* This option overwrites all `log` settings
|
|
209
|
-
*
|
|
210
|
-
* @default false
|
|
211
|
-
*/
|
|
212
|
-
debug?: boolean;
|
|
213
|
-
/**
|
|
214
|
-
* This option overwrites the `debug` settings
|
|
215
|
-
*
|
|
216
|
-
* @default false
|
|
217
|
-
*/
|
|
218
|
-
quiet?: boolean;
|
|
219
|
-
/**
|
|
220
|
-
* Determines the mode of test execution
|
|
221
|
-
*
|
|
222
|
-
* @default false
|
|
223
|
-
*/
|
|
191
|
+
/** Run tests sequentially */
|
|
224
192
|
sequential?: boolean;
|
|
225
|
-
/**
|
|
226
|
-
* Controls process isolation for test files
|
|
227
|
-
*
|
|
228
|
-
* - `'process'` (default): each test file runs in a separate child process
|
|
229
|
-
* - `'none'`: all test files run in the same process (useful for debugging with `--inspect`)
|
|
230
|
-
*
|
|
231
|
-
* @default 'process'
|
|
232
|
-
*/
|
|
233
193
|
isolation?: 'none' | 'process' | CustomString;
|
|
234
|
-
/**
|
|
235
|
-
* Stops the tests at the first failure.
|
|
236
|
-
*
|
|
237
|
-
* @default false
|
|
238
|
-
*/
|
|
194
|
+
/** Stop execution at the first error */
|
|
239
195
|
failFast?: boolean;
|
|
240
|
-
/**
|
|
241
|
-
* Limits the number of tests running concurrently
|
|
242
|
-
*
|
|
243
|
-
* @default (availableParallelism() || cpus().lenght)
|
|
244
|
-
*/
|
|
196
|
+
/** @default (availableParallelism() || cpus().lenght) */
|
|
245
197
|
concurrency?: number;
|
|
246
|
-
/**
|
|
247
|
-
* Sets the maximum time in milliseconds that each test file is allowed to run
|
|
248
|
-
*
|
|
249
|
-
* @default undefined
|
|
250
|
-
*/
|
|
198
|
+
/** Set a timeout for each test file */
|
|
251
199
|
timeout?: number;
|
|
252
|
-
/**
|
|
253
|
-
* @default "poku"
|
|
254
|
-
*/
|
|
200
|
+
/** @default "poku" */
|
|
255
201
|
reporter?: Reporter;
|
|
256
|
-
/**
|
|
257
|
-
* You can use this option to run a **callback** or a **file** before each test file on your suite
|
|
258
|
-
*
|
|
259
|
-
* ```ts
|
|
260
|
-
* beforeEach(() => myFunc())
|
|
261
|
-
* ```
|
|
262
|
-
*
|
|
263
|
-
* ```ts
|
|
264
|
-
* beforeEach(async () => await myAsyncFunc())
|
|
265
|
-
* ```
|
|
266
|
-
*/
|
|
202
|
+
/** Run a callback or a file before each test file */
|
|
267
203
|
beforeEach?: () => unknown | Promise<unknown>;
|
|
268
|
-
/**
|
|
269
|
-
* You can use this option to run a **callback** or a **file** after each test file on your suite
|
|
270
|
-
*
|
|
271
|
-
* ```ts
|
|
272
|
-
* afterEach(() => myFunc())
|
|
273
|
-
* ```
|
|
274
|
-
*
|
|
275
|
-
* ```ts
|
|
276
|
-
* afterEach(async () => await myAsyncFunc())
|
|
277
|
-
* ```
|
|
278
|
-
*/
|
|
204
|
+
/** Run a callback or a file after each test file */
|
|
279
205
|
afterEach?: () => unknown | Promise<unknown>;
|
|
280
206
|
deno?: DenoOptions;
|
|
281
|
-
/**
|
|
282
|
-
* Plugins to extend Poku's behavior
|
|
283
|
-
*
|
|
284
|
-
* @default undefined
|
|
285
|
-
*/
|
|
286
207
|
plugins?: PokuPlugin[];
|
|
287
|
-
/**
|
|
288
|
-
* Only run tests whose title matches the given regex pattern
|
|
289
|
-
*
|
|
290
|
-
* @default undefined
|
|
291
|
-
*/
|
|
208
|
+
/** Only run tests whose title matches the given regex pattern */
|
|
292
209
|
testNamePattern?: RegExp;
|
|
293
|
-
/**
|
|
294
|
-
* Skip tests whose title matches the given regex pattern
|
|
295
|
-
*
|
|
296
|
-
* @default undefined
|
|
297
|
-
*/
|
|
210
|
+
/** Skip tests whose title matches the given regex pattern */
|
|
298
211
|
testSkipPattern?: RegExp;
|
|
212
|
+
debug?: boolean;
|
|
213
|
+
quiet?: boolean;
|
|
214
|
+
noExit?: boolean;
|
|
299
215
|
} & Configs$1;
|
|
300
216
|
type Timespan = {
|
|
301
217
|
started: Date;
|
|
@@ -303,17 +219,11 @@ type Timespan = {
|
|
|
303
219
|
duration: number;
|
|
304
220
|
};
|
|
305
221
|
type CliConfigs = {
|
|
306
|
-
/** Default: searches for _`.test.`_ and `.spec.` files, but you can customize it */
|
|
307
222
|
include?: string | string[];
|
|
308
|
-
/** Reads an environment file and sets the environment variables */
|
|
309
223
|
envFile?: string;
|
|
310
|
-
/** Terminates the specified ports, port ranges and process IDs */
|
|
311
224
|
kill?: {
|
|
312
|
-
/** Terminates the specified ports before running the test suite */
|
|
313
225
|
port?: [number];
|
|
314
|
-
/** Terminates the specified port range before running the test suite */
|
|
315
226
|
range?: [number, number][];
|
|
316
|
-
/** Terminates the specified processes before running the test suite */
|
|
317
227
|
pid?: [number];
|
|
318
228
|
};
|
|
319
229
|
};
|
package/lib/modules/_shared.d.ts
CHANGED
|
@@ -4,17 +4,8 @@ import { ChildProcess, ChildProcessWithoutNullStreams } from 'node:child_process
|
|
|
4
4
|
type Code = 0 | 1;
|
|
5
5
|
|
|
6
6
|
type Configs$1 = {
|
|
7
|
-
/**
|
|
8
|
-
* Filter by path to match only the files that should be performed.
|
|
9
|
-
*
|
|
10
|
-
* @default /\.(test|spec)\./i
|
|
11
|
-
*/
|
|
7
|
+
/** @default /\.(test|spec)\./i */
|
|
12
8
|
filter?: RegExp;
|
|
13
|
-
/**
|
|
14
|
-
* Exclude by path to match only the files that should be performed.
|
|
15
|
-
*
|
|
16
|
-
* @default undefined
|
|
17
|
-
*/
|
|
18
9
|
exclude?: RegExp | RegExp[];
|
|
19
10
|
};
|
|
20
11
|
|
|
@@ -92,9 +83,8 @@ type PluginContext = {
|
|
|
92
83
|
readonly reporter: ReturnType<ReporterPlugin>;
|
|
93
84
|
};
|
|
94
85
|
type PokuPlugin = {
|
|
95
|
-
/** Plugin name */
|
|
96
86
|
name?: string;
|
|
97
|
-
/** Modify the command
|
|
87
|
+
/** Modify the command before spawning a test file process */
|
|
98
88
|
runner?: (command: string[], file: string) => string[];
|
|
99
89
|
/** Run before the test suite begins */
|
|
100
90
|
setup?: (context: PluginContext) => void | Promise<void>;
|
|
@@ -198,104 +188,30 @@ type DenoOptions = {
|
|
|
198
188
|
type Runtime = 'node' | 'bun' | 'deno';
|
|
199
189
|
type Reporter = 'poku' | 'focus' | 'dot' | 'compact' | 'classic' | ReporterPlugin | CustomString;
|
|
200
190
|
type Configs = {
|
|
201
|
-
/**
|
|
202
|
-
* By setting `true`, **Poku** won't exit the process and will return the exit code (`0` or `1`)
|
|
203
|
-
*
|
|
204
|
-
* @default false
|
|
205
|
-
*/
|
|
206
|
-
noExit?: boolean;
|
|
207
|
-
/**
|
|
208
|
-
* This option overwrites all `log` settings
|
|
209
|
-
*
|
|
210
|
-
* @default false
|
|
211
|
-
*/
|
|
212
|
-
debug?: boolean;
|
|
213
|
-
/**
|
|
214
|
-
* This option overwrites the `debug` settings
|
|
215
|
-
*
|
|
216
|
-
* @default false
|
|
217
|
-
*/
|
|
218
|
-
quiet?: boolean;
|
|
219
|
-
/**
|
|
220
|
-
* Determines the mode of test execution
|
|
221
|
-
*
|
|
222
|
-
* @default false
|
|
223
|
-
*/
|
|
191
|
+
/** Run tests sequentially */
|
|
224
192
|
sequential?: boolean;
|
|
225
|
-
/**
|
|
226
|
-
* Controls process isolation for test files
|
|
227
|
-
*
|
|
228
|
-
* - `'process'` (default): each test file runs in a separate child process
|
|
229
|
-
* - `'none'`: all test files run in the same process (useful for debugging with `--inspect`)
|
|
230
|
-
*
|
|
231
|
-
* @default 'process'
|
|
232
|
-
*/
|
|
233
193
|
isolation?: 'none' | 'process' | CustomString;
|
|
234
|
-
/**
|
|
235
|
-
* Stops the tests at the first failure.
|
|
236
|
-
*
|
|
237
|
-
* @default false
|
|
238
|
-
*/
|
|
194
|
+
/** Stop execution at the first error */
|
|
239
195
|
failFast?: boolean;
|
|
240
|
-
/**
|
|
241
|
-
* Limits the number of tests running concurrently
|
|
242
|
-
*
|
|
243
|
-
* @default (availableParallelism() || cpus().lenght)
|
|
244
|
-
*/
|
|
196
|
+
/** @default (availableParallelism() || cpus().lenght) */
|
|
245
197
|
concurrency?: number;
|
|
246
|
-
/**
|
|
247
|
-
* Sets the maximum time in milliseconds that each test file is allowed to run
|
|
248
|
-
*
|
|
249
|
-
* @default undefined
|
|
250
|
-
*/
|
|
198
|
+
/** Set a timeout for each test file */
|
|
251
199
|
timeout?: number;
|
|
252
|
-
/**
|
|
253
|
-
* @default "poku"
|
|
254
|
-
*/
|
|
200
|
+
/** @default "poku" */
|
|
255
201
|
reporter?: Reporter;
|
|
256
|
-
/**
|
|
257
|
-
* You can use this option to run a **callback** or a **file** before each test file on your suite
|
|
258
|
-
*
|
|
259
|
-
* ```ts
|
|
260
|
-
* beforeEach(() => myFunc())
|
|
261
|
-
* ```
|
|
262
|
-
*
|
|
263
|
-
* ```ts
|
|
264
|
-
* beforeEach(async () => await myAsyncFunc())
|
|
265
|
-
* ```
|
|
266
|
-
*/
|
|
202
|
+
/** Run a callback or a file before each test file */
|
|
267
203
|
beforeEach?: () => unknown | Promise<unknown>;
|
|
268
|
-
/**
|
|
269
|
-
* You can use this option to run a **callback** or a **file** after each test file on your suite
|
|
270
|
-
*
|
|
271
|
-
* ```ts
|
|
272
|
-
* afterEach(() => myFunc())
|
|
273
|
-
* ```
|
|
274
|
-
*
|
|
275
|
-
* ```ts
|
|
276
|
-
* afterEach(async () => await myAsyncFunc())
|
|
277
|
-
* ```
|
|
278
|
-
*/
|
|
204
|
+
/** Run a callback or a file after each test file */
|
|
279
205
|
afterEach?: () => unknown | Promise<unknown>;
|
|
280
206
|
deno?: DenoOptions;
|
|
281
|
-
/**
|
|
282
|
-
* Plugins to extend Poku's behavior
|
|
283
|
-
*
|
|
284
|
-
* @default undefined
|
|
285
|
-
*/
|
|
286
207
|
plugins?: PokuPlugin[];
|
|
287
|
-
/**
|
|
288
|
-
* Only run tests whose title matches the given regex pattern
|
|
289
|
-
*
|
|
290
|
-
* @default undefined
|
|
291
|
-
*/
|
|
208
|
+
/** Only run tests whose title matches the given regex pattern */
|
|
292
209
|
testNamePattern?: RegExp;
|
|
293
|
-
/**
|
|
294
|
-
* Skip tests whose title matches the given regex pattern
|
|
295
|
-
*
|
|
296
|
-
* @default undefined
|
|
297
|
-
*/
|
|
210
|
+
/** Skip tests whose title matches the given regex pattern */
|
|
298
211
|
testSkipPattern?: RegExp;
|
|
212
|
+
debug?: boolean;
|
|
213
|
+
quiet?: boolean;
|
|
214
|
+
noExit?: boolean;
|
|
299
215
|
} & Configs$1;
|
|
300
216
|
type Timespan = {
|
|
301
217
|
started: Date;
|
|
@@ -303,17 +219,11 @@ type Timespan = {
|
|
|
303
219
|
duration: number;
|
|
304
220
|
};
|
|
305
221
|
type CliConfigs = {
|
|
306
|
-
/** Default: searches for _`.test.`_ and `.spec.` files, but you can customize it */
|
|
307
222
|
include?: string | string[];
|
|
308
|
-
/** Reads an environment file and sets the environment variables */
|
|
309
223
|
envFile?: string;
|
|
310
|
-
/** Terminates the specified ports, port ranges and process IDs */
|
|
311
224
|
kill?: {
|
|
312
|
-
/** Terminates the specified ports before running the test suite */
|
|
313
225
|
port?: [number];
|
|
314
|
-
/** Terminates the specified port range before running the test suite */
|
|
315
226
|
range?: [number, number][];
|
|
316
|
-
/** Terminates the specified processes before running the test suite */
|
|
317
227
|
pid?: [number];
|
|
318
228
|
};
|
|
319
229
|
};
|
package/lib/modules/_shared.js
CHANGED
|
@@ -441,7 +441,7 @@ const states = getSharedState("states", {
|
|
|
441
441
|
}), errorHoist = getSharedState("errorHoist", {
|
|
442
442
|
depth: 0,
|
|
443
443
|
failed: !1
|
|
444
|
-
}), VERSION = "4.
|
|
444
|
+
}), VERSION = "4.4.0", deepOptions = getSharedState("deepOptions", []), GLOBAL = getSharedState("GLOBAL", {
|
|
445
445
|
cwd: cwd$1,
|
|
446
446
|
configs: {
|
|
447
447
|
filter: void 0,
|
|
@@ -874,14 +874,12 @@ const poku = (async (targetPaths, configs) => {
|
|
|
874
874
|
if (typeof messageOrCb == "function") return itBase2(messageOrCb);
|
|
875
875
|
}), SCOPE_HOOKS_KEY = /* @__PURE__ */ Symbol.for("@pokujs/poku.test-scope-hooks"), getScopeHook = () => globalThis[SCOPE_HOOKS_KEY], itBase = async (titleOrCb, callback) => {
|
|
876
876
|
try {
|
|
877
|
-
const title = getTitle(titleOrCb), hasTitle = typeof title == "string", cb = getCallback(hasTitle ? callback : titleOrCb);
|
|
878
|
-
let success = !0, start, end;
|
|
877
|
+
const title = getTitle(titleOrCb), hasTitle = typeof title == "string", cb = getCallback(hasTitle ? callback : titleOrCb), insideDescribe = errorHoist.depth > 0;
|
|
878
|
+
let success = !0, start, end, onError;
|
|
879
879
|
if (GLOBAL.reporter.onItStart({ title }), hasTitle && indentation.itDepth++, typeof each.before.cb == "function") {
|
|
880
880
|
const beforeResult = each.before.cb();
|
|
881
881
|
beforeResult instanceof Promise && await beforeResult;
|
|
882
882
|
}
|
|
883
|
-
const insideDescribe = errorHoist.depth > 0;
|
|
884
|
-
let onError;
|
|
885
883
|
insideDescribe ? errorHoist.failed = !1 : (onError = (error) => {
|
|
886
884
|
const ctx = retryContext.stack?.[retryContext.stack.length - 1];
|
|
887
885
|
ctx ? ctx.failed = !0 : (process$1.exitCode = 1, success = !1, error instanceof AssertionError || console.error(error));
|
|
@@ -1157,18 +1155,14 @@ const regex = {
|
|
|
1157
1155
|
}), killPID = async (PID) => {
|
|
1158
1156
|
const PIDs = setPortsAndPIDs(PID);
|
|
1159
1157
|
await Promise.all(
|
|
1160
|
-
PIDs.map(
|
|
1161
|
-
isWindows ?
|
|
1162
|
-
|
|
1158
|
+
PIDs.map(
|
|
1159
|
+
async (p) => isWindows ? killPID$1.windows(p) : killPID$1.unix(p)
|
|
1160
|
+
)
|
|
1163
1161
|
);
|
|
1164
1162
|
}, killPIDs = async (PIDs) => {
|
|
1165
1163
|
for (const PID of PIDs)
|
|
1166
1164
|
PID && await killPID(PID);
|
|
1167
|
-
}, killPort = async (port) => {
|
|
1168
|
-
await killPIDs(await getPIDs(port));
|
|
1169
|
-
}, killRange = async (startsAt, endsAt) => {
|
|
1170
|
-
await killPIDs(await getPIDs.range(startsAt, endsAt));
|
|
1171
|
-
}, kill = {
|
|
1165
|
+
}, killPort = async (port) => killPIDs(await getPIDs(port)), killRange = async (startsAt, endsAt) => killPIDs(await getPIDs.range(startsAt, endsAt)), kill = {
|
|
1172
1166
|
pid: killPID,
|
|
1173
1167
|
port: killPort,
|
|
1174
1168
|
range: killRange
|
package/lib/modules/index.d.cts
CHANGED
|
@@ -80,7 +80,6 @@ declare const it: It & {
|
|
|
80
80
|
only: Modifier;
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
-
/** Reads an environment file and sets the environment variables. */
|
|
84
83
|
declare const envFile: (filePath?: string) => Promise<void>;
|
|
85
84
|
|
|
86
85
|
declare const skip: (message?: string) => never;
|
|
@@ -94,41 +93,7 @@ type EachOptions = {
|
|
|
94
93
|
immediate?: boolean;
|
|
95
94
|
};
|
|
96
95
|
|
|
97
|
-
/**
|
|
98
|
-
* Handle **global states** and **external** services before each `test` or `it`.
|
|
99
|
-
*
|
|
100
|
-
* ---
|
|
101
|
-
*
|
|
102
|
-
* ```ts
|
|
103
|
-
* import { beforeEach } from 'poku';
|
|
104
|
-
*
|
|
105
|
-
* const before = beforeEach(() => {
|
|
106
|
-
* // prepare
|
|
107
|
-
* };
|
|
108
|
-
*
|
|
109
|
-
* before.pause();
|
|
110
|
-
* before.continue();
|
|
111
|
-
* before.reset();
|
|
112
|
-
* ```
|
|
113
|
-
*/
|
|
114
96
|
declare const beforeEach: (callback: () => unknown, options?: EachOptions) => Control;
|
|
115
|
-
/**
|
|
116
|
-
* Handle **global states** and **external** services after each `test` or `it`.
|
|
117
|
-
*
|
|
118
|
-
* ---
|
|
119
|
-
*
|
|
120
|
-
* ```ts
|
|
121
|
-
* import { afterEach } from 'poku';
|
|
122
|
-
*
|
|
123
|
-
* const after = afterEach(() => {
|
|
124
|
-
* // cleanup
|
|
125
|
-
* };
|
|
126
|
-
*
|
|
127
|
-
* after.pause();
|
|
128
|
-
* after.continue();
|
|
129
|
-
* after.reset();
|
|
130
|
-
* ```
|
|
131
|
-
*/
|
|
132
97
|
declare const afterEach: (callback: () => unknown) => Control;
|
|
133
98
|
|
|
134
99
|
type RetryConfig = {
|
|
@@ -141,115 +106,54 @@ declare function retry(config: number | RetryConfig, callback: () => unknown | P
|
|
|
141
106
|
type Runner = 'npm' | 'bun' | 'deno' | 'yarn' | 'pnpm';
|
|
142
107
|
|
|
143
108
|
type BackgroundProcessOptions = {
|
|
144
|
-
/**
|
|
145
|
-
* - Default: resolves in the first console output
|
|
146
|
-
* - String: waits for a specifc string on console output to resolve
|
|
147
|
-
* - Number: waits for time in milliseconds to resolve
|
|
148
|
-
*
|
|
149
|
-
* @default undefined
|
|
150
|
-
*/
|
|
151
109
|
startAfter?: string | number;
|
|
152
|
-
/**
|
|
153
|
-
* Stops the service for neither success nor failure after:
|
|
154
|
-
*
|
|
155
|
-
* @default 60000
|
|
156
|
-
*/
|
|
157
110
|
timeout?: number;
|
|
158
|
-
/** Shows the output from service */
|
|
159
111
|
verbose?: boolean;
|
|
160
|
-
/**
|
|
161
|
-
* Specify a target path to start the process
|
|
162
|
-
*
|
|
163
|
-
* @default "./"
|
|
164
|
-
*/
|
|
165
112
|
cwd?: string | undefined;
|
|
166
113
|
};
|
|
167
114
|
type StartScriptOptions = {
|
|
168
|
-
/** By default, Poku will use `npm`. Change it as you want */
|
|
169
115
|
readonly runner?: Runner;
|
|
170
116
|
} & BackgroundProcessOptions;
|
|
171
117
|
type StartServiceOptions = BackgroundProcessOptions;
|
|
172
118
|
type End = (port?: number | number[]) => Promise<void>;
|
|
173
119
|
|
|
174
|
-
/** Starts a file in a background process (useful for servers, APIs, etc.) */
|
|
175
120
|
declare const startService: (file: string, options?: StartServiceOptions) => Promise<{
|
|
176
121
|
end: End;
|
|
177
122
|
}>;
|
|
178
|
-
/**
|
|
179
|
-
*
|
|
180
|
-
* Starts a script (package.json) or task (deno.json) in a background process (useful for servers, APIs, etc.).
|
|
181
|
-
*
|
|
182
|
-
* ---
|
|
183
|
-
*
|
|
184
|
-
* By default it uses **npm**, but you can costumize it using the `runner` option.
|
|
185
|
-
*/
|
|
186
123
|
declare const startScript: (script: string, options?: StartScriptOptions) => Promise<{
|
|
187
124
|
end: End;
|
|
188
125
|
}>;
|
|
189
126
|
|
|
190
127
|
type WaitForExpectedResultOptions = {
|
|
191
|
-
/**
|
|
192
|
-
* Retry interval in milliseconds
|
|
193
|
-
*
|
|
194
|
-
* @default 100
|
|
195
|
-
*/
|
|
128
|
+
/** @default 100 */
|
|
196
129
|
interval?: number;
|
|
197
|
-
/**
|
|
198
|
-
* Timeout in milliseconds
|
|
199
|
-
*
|
|
200
|
-
* @default 60000
|
|
201
|
-
*/
|
|
130
|
+
/** @default 60000 */
|
|
202
131
|
timeout?: number;
|
|
203
|
-
/**
|
|
204
|
-
* Delays both the start and end by the defined milliseconds
|
|
205
|
-
*
|
|
206
|
-
* @default 0
|
|
207
|
-
*/
|
|
208
132
|
delay?: number;
|
|
209
|
-
/**
|
|
210
|
-
* Ensure strict comparisons
|
|
211
|
-
*
|
|
212
|
-
* - For **Bun** users, this option isn't necessary
|
|
213
|
-
*
|
|
214
|
-
* @default false
|
|
215
|
-
*/
|
|
133
|
+
/** Ensure strict comparisons */
|
|
216
134
|
strict?: boolean;
|
|
217
135
|
};
|
|
218
136
|
type WaitForPortOptions = {
|
|
219
|
-
/**
|
|
220
|
-
* Host to check the port on
|
|
221
|
-
*
|
|
222
|
-
* @default "localhost"
|
|
223
|
-
*/
|
|
137
|
+
/** @default "localhost" */
|
|
224
138
|
host?: string;
|
|
225
139
|
} & Omit<WaitForExpectedResultOptions, 'strict'>;
|
|
226
140
|
|
|
227
|
-
|
|
228
|
-
declare const sleep: (milliseconds: number) => Promise<void>;
|
|
229
|
-
/** Wait until a result is equal the expected value. */
|
|
141
|
+
declare const sleep: (milliseconds: number) => Promise<unknown>;
|
|
230
142
|
declare const waitForExpectedResult: (callback: () => unknown | Promise<unknown>, expectedResult: unknown, options?: WaitForExpectedResultOptions) => Promise<void>;
|
|
231
|
-
/** Wait until the defined port is active. */
|
|
232
143
|
declare const waitForPort: (port: number, options?: WaitForPortOptions) => Promise<void>;
|
|
233
144
|
|
|
234
|
-
/** Kill processes by PIDs, ports and port ranges. */
|
|
235
145
|
declare const kill: {
|
|
236
|
-
/** Kill the specified process ID */
|
|
237
146
|
pid: (PID: number | number[]) => Promise<void>;
|
|
238
|
-
/** Kill all processes listening on the specified port */
|
|
239
147
|
port: (port: number | number[]) => Promise<void>;
|
|
240
|
-
/** Kill all processes listening on the specified range ports */
|
|
241
148
|
range: (startsAt: number, endsAt: number) => Promise<void>;
|
|
242
149
|
};
|
|
243
150
|
|
|
244
|
-
/** Returns an array containing the ID of all processes listening to the specified port */
|
|
245
151
|
declare const getPIDs: ((port: number | number[]) => Promise<number[]>) & {
|
|
246
|
-
/** Returns an array containing the ID of all processes listening to the specified port range */
|
|
247
152
|
range: (startsAt: number, endsAt: number) => Promise<number[]>;
|
|
248
153
|
};
|
|
249
154
|
|
|
250
155
|
declare const exit: (code: Code, quiet?: boolean) => void;
|
|
251
156
|
|
|
252
|
-
/** By default **Poku** only shows outputs generated from itself. This helper allows you to use an alternative to `console.log` with **Poku**. */
|
|
253
157
|
declare const log: (...args: unknown[]) => void;
|
|
254
158
|
|
|
255
159
|
declare const listFiles: (targetDir: string, configs?: Configs) => Promise<string[]>;
|
package/lib/modules/index.d.ts
CHANGED
|
@@ -80,7 +80,6 @@ declare const it: It & {
|
|
|
80
80
|
only: Modifier;
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
-
/** Reads an environment file and sets the environment variables. */
|
|
84
83
|
declare const envFile: (filePath?: string) => Promise<void>;
|
|
85
84
|
|
|
86
85
|
declare const skip: (message?: string) => never;
|
|
@@ -94,41 +93,7 @@ type EachOptions = {
|
|
|
94
93
|
immediate?: boolean;
|
|
95
94
|
};
|
|
96
95
|
|
|
97
|
-
/**
|
|
98
|
-
* Handle **global states** and **external** services before each `test` or `it`.
|
|
99
|
-
*
|
|
100
|
-
* ---
|
|
101
|
-
*
|
|
102
|
-
* ```ts
|
|
103
|
-
* import { beforeEach } from 'poku';
|
|
104
|
-
*
|
|
105
|
-
* const before = beforeEach(() => {
|
|
106
|
-
* // prepare
|
|
107
|
-
* };
|
|
108
|
-
*
|
|
109
|
-
* before.pause();
|
|
110
|
-
* before.continue();
|
|
111
|
-
* before.reset();
|
|
112
|
-
* ```
|
|
113
|
-
*/
|
|
114
96
|
declare const beforeEach: (callback: () => unknown, options?: EachOptions) => Control;
|
|
115
|
-
/**
|
|
116
|
-
* Handle **global states** and **external** services after each `test` or `it`.
|
|
117
|
-
*
|
|
118
|
-
* ---
|
|
119
|
-
*
|
|
120
|
-
* ```ts
|
|
121
|
-
* import { afterEach } from 'poku';
|
|
122
|
-
*
|
|
123
|
-
* const after = afterEach(() => {
|
|
124
|
-
* // cleanup
|
|
125
|
-
* };
|
|
126
|
-
*
|
|
127
|
-
* after.pause();
|
|
128
|
-
* after.continue();
|
|
129
|
-
* after.reset();
|
|
130
|
-
* ```
|
|
131
|
-
*/
|
|
132
97
|
declare const afterEach: (callback: () => unknown) => Control;
|
|
133
98
|
|
|
134
99
|
type RetryConfig = {
|
|
@@ -141,115 +106,54 @@ declare function retry(config: number | RetryConfig, callback: () => unknown | P
|
|
|
141
106
|
type Runner = 'npm' | 'bun' | 'deno' | 'yarn' | 'pnpm';
|
|
142
107
|
|
|
143
108
|
type BackgroundProcessOptions = {
|
|
144
|
-
/**
|
|
145
|
-
* - Default: resolves in the first console output
|
|
146
|
-
* - String: waits for a specifc string on console output to resolve
|
|
147
|
-
* - Number: waits for time in milliseconds to resolve
|
|
148
|
-
*
|
|
149
|
-
* @default undefined
|
|
150
|
-
*/
|
|
151
109
|
startAfter?: string | number;
|
|
152
|
-
/**
|
|
153
|
-
* Stops the service for neither success nor failure after:
|
|
154
|
-
*
|
|
155
|
-
* @default 60000
|
|
156
|
-
*/
|
|
157
110
|
timeout?: number;
|
|
158
|
-
/** Shows the output from service */
|
|
159
111
|
verbose?: boolean;
|
|
160
|
-
/**
|
|
161
|
-
* Specify a target path to start the process
|
|
162
|
-
*
|
|
163
|
-
* @default "./"
|
|
164
|
-
*/
|
|
165
112
|
cwd?: string | undefined;
|
|
166
113
|
};
|
|
167
114
|
type StartScriptOptions = {
|
|
168
|
-
/** By default, Poku will use `npm`. Change it as you want */
|
|
169
115
|
readonly runner?: Runner;
|
|
170
116
|
} & BackgroundProcessOptions;
|
|
171
117
|
type StartServiceOptions = BackgroundProcessOptions;
|
|
172
118
|
type End = (port?: number | number[]) => Promise<void>;
|
|
173
119
|
|
|
174
|
-
/** Starts a file in a background process (useful for servers, APIs, etc.) */
|
|
175
120
|
declare const startService: (file: string, options?: StartServiceOptions) => Promise<{
|
|
176
121
|
end: End;
|
|
177
122
|
}>;
|
|
178
|
-
/**
|
|
179
|
-
*
|
|
180
|
-
* Starts a script (package.json) or task (deno.json) in a background process (useful for servers, APIs, etc.).
|
|
181
|
-
*
|
|
182
|
-
* ---
|
|
183
|
-
*
|
|
184
|
-
* By default it uses **npm**, but you can costumize it using the `runner` option.
|
|
185
|
-
*/
|
|
186
123
|
declare const startScript: (script: string, options?: StartScriptOptions) => Promise<{
|
|
187
124
|
end: End;
|
|
188
125
|
}>;
|
|
189
126
|
|
|
190
127
|
type WaitForExpectedResultOptions = {
|
|
191
|
-
/**
|
|
192
|
-
* Retry interval in milliseconds
|
|
193
|
-
*
|
|
194
|
-
* @default 100
|
|
195
|
-
*/
|
|
128
|
+
/** @default 100 */
|
|
196
129
|
interval?: number;
|
|
197
|
-
/**
|
|
198
|
-
* Timeout in milliseconds
|
|
199
|
-
*
|
|
200
|
-
* @default 60000
|
|
201
|
-
*/
|
|
130
|
+
/** @default 60000 */
|
|
202
131
|
timeout?: number;
|
|
203
|
-
/**
|
|
204
|
-
* Delays both the start and end by the defined milliseconds
|
|
205
|
-
*
|
|
206
|
-
* @default 0
|
|
207
|
-
*/
|
|
208
132
|
delay?: number;
|
|
209
|
-
/**
|
|
210
|
-
* Ensure strict comparisons
|
|
211
|
-
*
|
|
212
|
-
* - For **Bun** users, this option isn't necessary
|
|
213
|
-
*
|
|
214
|
-
* @default false
|
|
215
|
-
*/
|
|
133
|
+
/** Ensure strict comparisons */
|
|
216
134
|
strict?: boolean;
|
|
217
135
|
};
|
|
218
136
|
type WaitForPortOptions = {
|
|
219
|
-
/**
|
|
220
|
-
* Host to check the port on
|
|
221
|
-
*
|
|
222
|
-
* @default "localhost"
|
|
223
|
-
*/
|
|
137
|
+
/** @default "localhost" */
|
|
224
138
|
host?: string;
|
|
225
139
|
} & Omit<WaitForExpectedResultOptions, 'strict'>;
|
|
226
140
|
|
|
227
|
-
|
|
228
|
-
declare const sleep: (milliseconds: number) => Promise<void>;
|
|
229
|
-
/** Wait until a result is equal the expected value. */
|
|
141
|
+
declare const sleep: (milliseconds: number) => Promise<unknown>;
|
|
230
142
|
declare const waitForExpectedResult: (callback: () => unknown | Promise<unknown>, expectedResult: unknown, options?: WaitForExpectedResultOptions) => Promise<void>;
|
|
231
|
-
/** Wait until the defined port is active. */
|
|
232
143
|
declare const waitForPort: (port: number, options?: WaitForPortOptions) => Promise<void>;
|
|
233
144
|
|
|
234
|
-
/** Kill processes by PIDs, ports and port ranges. */
|
|
235
145
|
declare const kill: {
|
|
236
|
-
/** Kill the specified process ID */
|
|
237
146
|
pid: (PID: number | number[]) => Promise<void>;
|
|
238
|
-
/** Kill all processes listening on the specified port */
|
|
239
147
|
port: (port: number | number[]) => Promise<void>;
|
|
240
|
-
/** Kill all processes listening on the specified range ports */
|
|
241
148
|
range: (startsAt: number, endsAt: number) => Promise<void>;
|
|
242
149
|
};
|
|
243
150
|
|
|
244
|
-
/** Returns an array containing the ID of all processes listening to the specified port */
|
|
245
151
|
declare const getPIDs: ((port: number | number[]) => Promise<number[]>) & {
|
|
246
|
-
/** Returns an array containing the ID of all processes listening to the specified port range */
|
|
247
152
|
range: (startsAt: number, endsAt: number) => Promise<number[]>;
|
|
248
153
|
};
|
|
249
154
|
|
|
250
155
|
declare const exit: (code: Code, quiet?: boolean) => void;
|
|
251
156
|
|
|
252
|
-
/** By default **Poku** only shows outputs generated from itself. This helper allows you to use an alternative to `console.log` with **Poku**. */
|
|
253
157
|
declare const log: (...args: unknown[]) => void;
|
|
254
158
|
|
|
255
159
|
declare const listFiles: (targetDir: string, configs?: Configs) => Promise<string[]>;
|
|
@@ -13,7 +13,6 @@ declare const reporter: Record<string, ReporterPlugin>;
|
|
|
13
13
|
|
|
14
14
|
/** 🐷 Auxiliary function to define a Poku plugin */
|
|
15
15
|
declare const definePlugin: (plugin: PokuPlugin) => PokuPlugin;
|
|
16
|
-
/** 🐽 Auxiliary function to inspect a Poku CLI execution during plugin development */
|
|
17
16
|
declare const inspectPoku: (options: {
|
|
18
17
|
command: string;
|
|
19
18
|
spawnOptions?: SpawnOptionsWithoutStdio;
|
package/lib/modules/plugins.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ declare const reporter: Record<string, ReporterPlugin>;
|
|
|
13
13
|
|
|
14
14
|
/** 🐷 Auxiliary function to define a Poku plugin */
|
|
15
15
|
declare const definePlugin: (plugin: PokuPlugin) => PokuPlugin;
|
|
16
|
-
/** 🐽 Auxiliary function to inspect a Poku CLI execution during plugin development */
|
|
17
16
|
declare const inspectPoku: (options: {
|
|
18
17
|
command: string;
|
|
19
18
|
spawnOptions?: SpawnOptionsWithoutStdio;
|