@adaptivestone/framework 5.1.3 → 5.1.4
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/CHANGELOG.md +14 -1
- package/dist/cluster.d.ts +3 -1
- package/dist/cluster.js +8 -64
- package/dist/cluster.js.map +1 -1
- package/dist/clusterRunner.d.ts +16 -0
- package/dist/clusterRunner.js +180 -0
- package/dist/clusterRunner.js.map +1 -0
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,20 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
-
## [
|
|
7
|
+
## [NEXT] - Unreleased
|
|
8
|
+
|
|
9
|
+
## [5.1.4] - 2026-07-19
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **Public Node cluster runner.** Consumers can import `runCluster` from `@adaptivestone/framework/cluster.js` to run a worker callback across a configurable number of processes. The narrow API exposes worker count, shutdown timeout, and a structured lifecycle-event hook; fixed internal safety policy provides delayed abnormal-exit recovery and crash-loop protection without turning the framework into a configurable process manager. SIGTERM/SIGINT are forwarded, stuck workers are force-terminated after the timeout, the callback runs only in workers, and importing the entry has no side effects. Clustering is optional—systemd, PM2, Kubernetes, and similar deployment supervisors should normally own replica count and restarts themselves. The framework's `prod` entry now uses this same implementation and no longer enables file watching implicitly.
|
|
14
|
+
|
|
15
|
+
### Documentation
|
|
16
|
+
|
|
17
|
+
- **Controller routing now documents the runtime rule precisely.** The default mount path is the controller-folder prefix plus the lowercased class name; the filename does not determine the URL and exporting one controller class from multiple files mounts it multiple times. Multi-word class names are not implicitly kebab-cased.
|
|
18
|
+
- **Typed rate-limit policies and stable validation assertions are documented.** Reusable limiter option objects can live under `config/rateLimiter.ts` `policy`, where generated config types catch misspelled names before the selected object is passed directly to `RateLimiter`. The testing guide now explains that application validation keys remain raw unless the application locale folder is explicitly enabled, so ordinary API tests should assert keys and status codes rather than translated prose.
|
|
19
|
+
|
|
20
|
+
## [5.1.3] - 2026-07-18
|
|
8
21
|
|
|
9
22
|
### Security
|
|
10
23
|
|
package/dist/cluster.d.ts
CHANGED
package/dist/cluster.js
CHANGED
|
@@ -1,67 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
// An orchestrator sends SIGTERM/SIGINT to PID 1 (the primary). Forward it to
|
|
11
|
-
// every worker so each drains gracefully via its own signal handler (workers
|
|
12
|
-
// run index.ts → startServer); the primary exits once the last worker is gone.
|
|
13
|
-
let shuttingDown = false;
|
|
14
|
-
for (const signal of ['SIGTERM', 'SIGINT']) {
|
|
15
|
-
process.on(signal, () => {
|
|
16
|
-
shuttingDown = true;
|
|
17
|
-
for (const worker of Object.values(cluster.workers ?? {})) {
|
|
18
|
-
worker?.kill(signal);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
// Bound crash-loop restarts. A worker that keeps dying on boot (bad config,
|
|
23
|
-
// port in use, missing Mongo/AUTH_SALT, unhandled rejection) must NOT be
|
|
24
|
-
// re-forked in a tight loop — that pegs every core and floods logs. Track
|
|
25
|
-
// restarts in a rolling window; if they arrive too fast, stop forking and
|
|
26
|
-
// exit so the orchestrator surfaces the crash-loop instead of the primary
|
|
27
|
-
// masking it forever. Healthy single crashes still recover (after a short
|
|
28
|
-
// backoff).
|
|
29
|
-
const RESTART_WINDOW_MS = 60_000;
|
|
30
|
-
const MAX_RESTARTS_PER_WINDOW = numCPUs * 5;
|
|
31
|
-
const RESTART_BACKOFF_MS = 1_000;
|
|
32
|
-
let restartTimes = [];
|
|
33
|
-
cluster.on('exit', (worker, code, signal) => {
|
|
34
|
-
if (shuttingDown) {
|
|
35
|
-
// Tearing down: don't resurrect; exit when the last worker has gone.
|
|
36
|
-
if (Object.keys(cluster.workers ?? {}).length === 0) {
|
|
37
|
-
process.exit(0);
|
|
38
|
-
}
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
// Deliberate shutdown (clean exit, no kill signal) — do not resurrect,
|
|
42
|
-
// otherwise the primary fights a graceful shutdown forever.
|
|
43
|
-
if (code === 0 && !signal) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const now = Date.now();
|
|
47
|
-
restartTimes = restartTimes.filter((t) => now - t < RESTART_WINDOW_MS);
|
|
48
|
-
restartTimes.push(now);
|
|
49
|
-
if (restartTimes.length > MAX_RESTARTS_PER_WINDOW) {
|
|
50
|
-
console.error(`Too many worker crashes (${restartTimes.length} in ${RESTART_WINDOW_MS / 1000}s). Refusing to keep forking — check the boot error above (config, DB, port). Exiting.`);
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
53
|
-
console.log(`Worker \x1B[45m ${worker.process.pid} \x1B[49m \x1B[41m †††† died †††† \x1B[49m. Code: ${signal || code}. Restarting in ${RESTART_BACKOFF_MS}ms...`);
|
|
54
|
-
setTimeout(() => {
|
|
55
|
-
if (!shuttingDown) {
|
|
56
|
-
cluster.fork();
|
|
57
|
-
}
|
|
58
|
-
}, RESTART_BACKOFF_MS).unref();
|
|
1
|
+
import { runCluster, } from './clusterRunner.js';
|
|
2
|
+
export { runCluster };
|
|
3
|
+
// Keep the framework's own production entry on the public implementation.
|
|
4
|
+
// Importing `@adaptivestone/framework/cluster.js` has no side effects; this runs
|
|
5
|
+
// only for `node src/cluster.ts` / `node dist/cluster.js`.
|
|
6
|
+
if (import.meta.main) {
|
|
7
|
+
await runCluster(async () => {
|
|
8
|
+
await import('./index.js');
|
|
59
9
|
});
|
|
60
10
|
}
|
|
61
|
-
else {
|
|
62
|
-
// index.ts is the entry that actually constructs the Server and starts
|
|
63
|
-
// listening. server.ts only DEFINES the class, so importing it here would
|
|
64
|
-
// let the worker's event loop drain and exit → infinite fork storm.
|
|
65
|
-
import('./index.js');
|
|
66
|
-
}
|
|
67
11
|
//# sourceMappingURL=cluster.js.map
|
package/dist/cluster.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cluster.js","sourceRoot":"","sources":["../src/cluster.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"cluster.js","sourceRoot":"","sources":["../src/cluster.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,GACX,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,0EAA0E;AAC1E,iFAAiF;AACjF,2DAA2D;AAC3D,IAAI,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;IACrB,MAAM,UAAU,CAAC,KAAK,IAAI,EAAE;QAC1B,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type ClusterWorkerCount = 'auto' | number;
|
|
2
|
+
export interface ClusterEvent {
|
|
3
|
+
type: 'primary:start' | 'worker:exit' | 'cluster:shutdown' | 'cluster:error';
|
|
4
|
+
level: 'info' | 'warn' | 'error';
|
|
5
|
+
message: string;
|
|
6
|
+
}
|
|
7
|
+
export interface RunClusterOptions {
|
|
8
|
+
/** Number of workers, or the host's available parallelism. Default: `auto`. */
|
|
9
|
+
workers?: ClusterWorkerCount;
|
|
10
|
+
/** Maximum time workers get to stop after a shutdown signal. Default: 30 seconds. */
|
|
11
|
+
shutdownTimeoutMs?: number;
|
|
12
|
+
/** Receives early lifecycle events before the application logger exists. */
|
|
13
|
+
onEvent?(event: ClusterEvent): void;
|
|
14
|
+
}
|
|
15
|
+
/** Run `startWorker` only in Node cluster workers; the primary supervises them. */
|
|
16
|
+
export declare function runCluster(startWorker: () => void | Promise<void>, options?: RunClusterOptions): Promise<void>;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import cluster, {} from 'node:cluster';
|
|
2
|
+
import { availableParallelism } from 'node:os';
|
|
3
|
+
const RESTART_DELAY_MS = 1_000;
|
|
4
|
+
const RESTART_WINDOW_MS = 60_000;
|
|
5
|
+
const RESTARTS_PER_WORKER = 5;
|
|
6
|
+
const DEFAULT_SHUTDOWN_TIMEOUT_MS = 30_000;
|
|
7
|
+
function defaultEventHandler(event) {
|
|
8
|
+
const write = event.level === 'error'
|
|
9
|
+
? console.error
|
|
10
|
+
: event.level === 'warn'
|
|
11
|
+
? console.warn
|
|
12
|
+
: console.log;
|
|
13
|
+
write(event.message);
|
|
14
|
+
}
|
|
15
|
+
function createEmitter(handler = defaultEventHandler) {
|
|
16
|
+
return (event) => {
|
|
17
|
+
try {
|
|
18
|
+
handler(event);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.error('Cluster onEvent callback failed:', error);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function resolveOptions(options) {
|
|
26
|
+
const workersOption = options.workers ?? 'auto';
|
|
27
|
+
const workers = workersOption === 'auto' ? availableParallelism() : workersOption;
|
|
28
|
+
if (!Number.isInteger(workers) || workers < 1) {
|
|
29
|
+
throw new RangeError('workers must be `auto` or a positive integer');
|
|
30
|
+
}
|
|
31
|
+
const shutdownTimeoutMs = options.shutdownTimeoutMs ?? DEFAULT_SHUTDOWN_TIMEOUT_MS;
|
|
32
|
+
if (!Number.isFinite(shutdownTimeoutMs) || shutdownTimeoutMs < 1) {
|
|
33
|
+
throw new RangeError('shutdownTimeoutMs must be a finite number >= 1');
|
|
34
|
+
}
|
|
35
|
+
return { workers, shutdownTimeoutMs };
|
|
36
|
+
}
|
|
37
|
+
/** Run `startWorker` only in Node cluster workers; the primary supervises them. */
|
|
38
|
+
export async function runCluster(startWorker, options = {}) {
|
|
39
|
+
const resolved = resolveOptions(options);
|
|
40
|
+
if (!cluster.isPrimary) {
|
|
41
|
+
await startWorker();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
await supervisePrimary(resolved.workers, resolved.shutdownTimeoutMs, createEmitter(options.onEvent));
|
|
45
|
+
}
|
|
46
|
+
function supervisePrimary(workerCount, shutdownTimeoutMs, emit) {
|
|
47
|
+
return new Promise((resolve) => {
|
|
48
|
+
const activeWorkers = new Map();
|
|
49
|
+
const restartTimers = new Set();
|
|
50
|
+
let restartTimes = [];
|
|
51
|
+
let shutdownTimer;
|
|
52
|
+
let shutdownSignal;
|
|
53
|
+
let shuttingDown = false;
|
|
54
|
+
let exitCode = 0;
|
|
55
|
+
let finished = false;
|
|
56
|
+
const onSigterm = () => beginShutdown('SIGTERM', 0);
|
|
57
|
+
const onSigint = () => beginShutdown('SIGINT', 0);
|
|
58
|
+
const report = (type, level, message) => emit({ type, level, message });
|
|
59
|
+
function finish() {
|
|
60
|
+
if (finished) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
finished = true;
|
|
64
|
+
cluster.off('exit', onWorkerExit);
|
|
65
|
+
process.off('SIGTERM', onSigterm);
|
|
66
|
+
process.off('SIGINT', onSigint);
|
|
67
|
+
if (shutdownTimer) {
|
|
68
|
+
clearTimeout(shutdownTimer);
|
|
69
|
+
}
|
|
70
|
+
for (const timer of restartTimers) {
|
|
71
|
+
clearTimeout(timer);
|
|
72
|
+
}
|
|
73
|
+
restartTimers.clear();
|
|
74
|
+
process.exitCode = exitCode;
|
|
75
|
+
resolve();
|
|
76
|
+
}
|
|
77
|
+
function finishIfIdle() {
|
|
78
|
+
if (activeWorkers.size === 0 && restartTimers.size === 0) {
|
|
79
|
+
finish();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function signalWorker(worker, signal) {
|
|
83
|
+
try {
|
|
84
|
+
worker.kill(signal);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
report('cluster:error', 'error', `Could not send ${signal} to worker ${worker.process.pid ?? worker.id}: ${error instanceof Error ? error.message : String(error)}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function beginShutdown(signal, code) {
|
|
91
|
+
exitCode = Math.max(exitCode, code);
|
|
92
|
+
if (shuttingDown) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
shuttingDown = true;
|
|
96
|
+
shutdownSignal = signal;
|
|
97
|
+
report('cluster:shutdown', code === 0 ? 'info' : 'error', `Cluster shutting down with ${signal}.`);
|
|
98
|
+
for (const timer of restartTimers) {
|
|
99
|
+
clearTimeout(timer);
|
|
100
|
+
}
|
|
101
|
+
restartTimers.clear();
|
|
102
|
+
if (activeWorkers.size === 0) {
|
|
103
|
+
finish();
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
shutdownTimer = setTimeout(() => {
|
|
107
|
+
shutdownTimer = undefined;
|
|
108
|
+
if (activeWorkers.size === 0) {
|
|
109
|
+
finishIfIdle();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
exitCode = 1;
|
|
113
|
+
report('cluster:error', 'error', `Cluster shutdown timed out after ${shutdownTimeoutMs}ms; force-terminating ${activeWorkers.size} worker(s).`);
|
|
114
|
+
for (const worker of activeWorkers.values()) {
|
|
115
|
+
signalWorker(worker, 'SIGKILL');
|
|
116
|
+
}
|
|
117
|
+
}, shutdownTimeoutMs);
|
|
118
|
+
for (const worker of activeWorkers.values()) {
|
|
119
|
+
signalWorker(worker, signal);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function forkWorker() {
|
|
123
|
+
if (shuttingDown) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
const worker = cluster.fork();
|
|
128
|
+
activeWorkers.set(worker.id, worker);
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
report('cluster:error', 'error', `Failed to fork cluster worker: ${error instanceof Error ? error.message : String(error)}`);
|
|
132
|
+
beginShutdown('SIGTERM', 1);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function scheduleRestart() {
|
|
136
|
+
const timer = setTimeout(() => {
|
|
137
|
+
restartTimers.delete(timer);
|
|
138
|
+
forkWorker();
|
|
139
|
+
finishIfIdle();
|
|
140
|
+
}, RESTART_DELAY_MS);
|
|
141
|
+
restartTimers.add(timer);
|
|
142
|
+
}
|
|
143
|
+
function onWorkerExit(worker, code, rawSignal) {
|
|
144
|
+
const signal = rawSignal;
|
|
145
|
+
activeWorkers.delete(worker.id);
|
|
146
|
+
if (shuttingDown) {
|
|
147
|
+
if (code !== 0 || (signal && signal !== shutdownSignal)) {
|
|
148
|
+
exitCode = 1;
|
|
149
|
+
}
|
|
150
|
+
finishIfIdle();
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (code === 0 && !signal) {
|
|
154
|
+
report('worker:exit', 'info', `Worker ${worker.process.pid ?? worker.id} exited cleanly; it will not be restarted.`);
|
|
155
|
+
finishIfIdle();
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const now = Date.now();
|
|
159
|
+
restartTimes = restartTimes.filter((time) => now - time < RESTART_WINDOW_MS);
|
|
160
|
+
const restartLimit = workerCount * RESTARTS_PER_WORKER;
|
|
161
|
+
if (restartTimes.length >= restartLimit) {
|
|
162
|
+
report('cluster:error', 'error', `Cluster exceeded its restart limit (${restartLimit} in ${RESTART_WINDOW_MS}ms).`);
|
|
163
|
+
beginShutdown('SIGTERM', 1);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
restartTimes.push(now);
|
|
167
|
+
report('worker:exit', 'warn', `Worker ${worker.process.pid ?? worker.id} exited abnormally (${signal ?? `code ${code}`}); restarting in ${RESTART_DELAY_MS}ms.`);
|
|
168
|
+
scheduleRestart();
|
|
169
|
+
}
|
|
170
|
+
cluster.on('exit', onWorkerExit);
|
|
171
|
+
process.once('SIGTERM', onSigterm);
|
|
172
|
+
process.once('SIGINT', onSigint);
|
|
173
|
+
report('primary:start', 'info', `Cluster primary ${process.pid} starting ${workerCount} worker(s).`);
|
|
174
|
+
for (let index = 0; index < workerCount; index += 1) {
|
|
175
|
+
forkWorker();
|
|
176
|
+
}
|
|
177
|
+
finishIfIdle();
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=clusterRunner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clusterRunner.js","sourceRoot":"","sources":["../src/clusterRunner.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAe,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAC/B,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACjC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,2BAA2B,GAAG,MAAM,CAAC;AAsB3C,SAAS,mBAAmB,CAAC,KAAmB;IAC9C,MAAM,KAAK,GACT,KAAK,CAAC,KAAK,KAAK,OAAO;QACrB,CAAC,CAAC,OAAO,CAAC,KAAK;QACf,CAAC,CAAC,KAAK,CAAC,KAAK,KAAK,MAAM;YACtB,CAAC,CAAC,OAAO,CAAC,IAAI;YACd,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;IACpB,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC;AAED,SAAS,aAAa,CAAC,OAAO,GAAG,mBAAmB;IAClD,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,IAAI,CAAC;YACH,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,OAA0B;IAIhD,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,IAAI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AAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACnC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACjC,MAAM,CACJ,eAAe,EACf,MAAM,EACN,mBAAmB,OAAO,CAAC,GAAG,aAAa,WAAW,aAAa,CACpE,CAAC;QACF,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,WAAW,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;YACpD,UAAU,EAAE,CAAC;QACf,CAAC;QACD,YAAY,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptivestone/framework",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.4",
|
|
4
4
|
"description": "Adaptive stone node js framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"./package.json": "./package.json",
|
|
11
11
|
"./server.js": "./dist/server.js",
|
|
12
12
|
"./Cli.js": "./dist/Cli.js",
|
|
13
|
+
"./cluster.js": "./dist/cluster.js",
|
|
13
14
|
"./types.js": "./dist/types.js",
|
|
14
15
|
"./folderConfig.js": "./dist/folderConfig.js",
|
|
15
16
|
"./config/*": "./dist/config/*",
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
"check:types:raw": "tsc --noEmit",
|
|
34
35
|
"check:types:fast": "npm run gen && tsc --noEmit",
|
|
35
36
|
"dev": "node --watch ./src/index.ts",
|
|
36
|
-
"prod": "node
|
|
37
|
+
"prod": "node ./src/cluster.ts",
|
|
37
38
|
"test": "vitest run",
|
|
38
39
|
"t": "vitest --coverage=false --reporter=default",
|
|
39
40
|
"test:node": "node --test --test-global-setup=./src/tests/globalSetupNodeTest.ts 'src/tests/**/*.node-test.ts'",
|