testeranto 0.36.3 → 0.37.1

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/index.d.ts ADDED
@@ -0,0 +1,377 @@
1
+ declare module "Features" {
2
+ const DirectedGraph: any, UndirectedGraph: any;
3
+ abstract class TesterantoGraph {
4
+ name: string;
5
+ abstract graph: any;
6
+ constructor(name: string);
7
+ }
8
+ export class BaseFeature {
9
+ name: string;
10
+ constructor(name: string);
11
+ }
12
+ export class TesterantoGraphUndirected implements TesterantoGraph {
13
+ name: string;
14
+ graph: typeof UndirectedGraph;
15
+ constructor(name: string);
16
+ connect(a: any, b: any, relation?: string): void;
17
+ }
18
+ export class TesterantoGraphDirected implements TesterantoGraph {
19
+ name: string;
20
+ graph: typeof DirectedGraph;
21
+ constructor(name: string);
22
+ connect(to: any, from: any, relation?: string): void;
23
+ }
24
+ export class TesterantoGraphDirectedAcyclic implements TesterantoGraph {
25
+ name: string;
26
+ graph: typeof DirectedGraph;
27
+ constructor(name: string);
28
+ connect(to: any, from: any, relation?: string): void;
29
+ }
30
+ export class TesterantoFeatures {
31
+ features: Record<string, BaseFeature>;
32
+ graphs: {
33
+ undirected: TesterantoGraphUndirected[];
34
+ directed: TesterantoGraphDirected[];
35
+ dags: TesterantoGraphDirectedAcyclic[];
36
+ };
37
+ constructor(features: Record<string, BaseFeature>, graphs: {
38
+ undirected: TesterantoGraphUndirected[];
39
+ directed: TesterantoGraphDirected[];
40
+ dags: TesterantoGraphDirectedAcyclic[];
41
+ });
42
+ networks(): (TesterantoGraphUndirected | TesterantoGraphDirected | TesterantoGraphDirectedAcyclic)[];
43
+ toObj(): {
44
+ features: {
45
+ inNetworks: {
46
+ network: string;
47
+ neighbors: any;
48
+ }[];
49
+ name: string;
50
+ }[];
51
+ networks: ({
52
+ name: string;
53
+ graph: any;
54
+ } | {
55
+ name: string;
56
+ graph: any;
57
+ } | {
58
+ name: string;
59
+ graph: any;
60
+ })[];
61
+ };
62
+ }
63
+ export type IT_FeatureNetwork = {
64
+ name: string;
65
+ };
66
+ }
67
+ declare module "IBaseConfig" {
68
+ import { TesterantoFeatures } from "Features";
69
+ export type ICollateMode = 'on' | 'off' | 'watch' | `serve` | `watch+serve` | `dev`;
70
+ export type IBaseConfig = {
71
+ clearScreen: boolean;
72
+ collateMode: ICollateMode;
73
+ features: TesterantoFeatures;
74
+ loaders: any[];
75
+ minify: boolean;
76
+ outbase: string;
77
+ outdir: string;
78
+ ports: string[];
79
+ collateEntry: string;
80
+ runMode: boolean;
81
+ tests: string[];
82
+ buildMode: 'on' | 'off' | 'watch';
83
+ };
84
+ }
85
+ declare module "index" {
86
+ import { BaseFeature } from "Features";
87
+ import { IBaseConfig } from "IBaseConfig";
88
+ export type { IBaseConfig };
89
+ type ITTestResourceConfiguration = {
90
+ "fs": string;
91
+ "ports": number[];
92
+ };
93
+ export type ITTestResourceRequirement = {
94
+ "ports": number;
95
+ "fs": string;
96
+ };
97
+ type IRunner = (x: ITTestResourceConfiguration, t: ITLog) => Promise<boolean>;
98
+ export type IT = {
99
+ toObj(): object;
100
+ name: string;
101
+ givens: BaseGiven<unknown, unknown, unknown, unknown, Record<string, BaseFeature>>[];
102
+ checks: BaseCheck<unknown, unknown, unknown, unknown, ITTestShape, unknown>[];
103
+ testResourceConfiguration: ITTestResourceConfiguration;
104
+ };
105
+ export type ITestJob = {
106
+ toObj(): object;
107
+ test: IT;
108
+ runner: IRunner;
109
+ testResourceRequirement: ITTestResourceRequirement;
110
+ receiveTestResourceConfig: (testResource?: any) => boolean;
111
+ };
112
+ export type ITestResults = Promise<{
113
+ test: IT;
114
+ }>[];
115
+ export type ITTestShape = {
116
+ suites: any;
117
+ givens: any;
118
+ whens: any;
119
+ thens: any;
120
+ checks: any;
121
+ };
122
+ export type ITestSpecification<ITestShape extends ITTestShape, IFeatureShape> = (Suite: {
123
+ [K in keyof ITestShape["suites"]]: (name: string, givens: BaseGiven<unknown, unknown, unknown, unknown, Record<string, BaseFeature>>[], checks: BaseCheck<unknown, unknown, unknown, unknown, ITestShape, IFeatureShape>[]) => BaseSuite<unknown, unknown, unknown, unknown, unknown, ITestShape, IFeatureShape>;
124
+ }, Given: {
125
+ [K in keyof ITestShape["givens"]]: (features: (keyof IFeatureShape)[], whens: BaseWhen<unknown, unknown, unknown>[], thens: BaseThen<unknown, unknown, unknown>[], ...xtras: ITestShape["givens"][K]) => BaseGiven<unknown, unknown, unknown, unknown, unknown>;
126
+ }, When: {
127
+ [K in keyof ITestShape["whens"]]: (...xtras: ITestShape["whens"][K]) => BaseWhen<unknown, unknown, unknown>;
128
+ }, Then: {
129
+ [K in keyof ITestShape["thens"]]: (...xtras: ITestShape["thens"][K]) => BaseThen<unknown, unknown, unknown>;
130
+ }, Check: {
131
+ [K in keyof ITestShape["checks"]]: (name: string, features: (keyof IFeatureShape)[], callbackA: (whens: {
132
+ [K in keyof ITestShape["whens"]]: (...unknown: any[]) => BaseWhen<unknown, unknown, unknown>;
133
+ }, thens: {
134
+ [K in keyof ITestShape["thens"]]: (...unknown: any[]) => BaseThen<unknown, unknown, unknown>;
135
+ }) => unknown, ...xtras: ITestShape["checks"][K]) => BaseCheck<unknown, unknown, unknown, unknown, ITestShape, IFeatureShape>;
136
+ }) => any[];
137
+ export type ITestImplementation<IState, ISelection, IWhenShape, IThenShape, ITestShape extends ITTestShape> = {
138
+ Suites: {
139
+ [K in keyof ITestShape["suites"]]: string;
140
+ };
141
+ Givens: {
142
+ [K in keyof ITestShape["givens"]]: (...Ig: ITestShape["givens"][K]) => IState;
143
+ };
144
+ Whens: {
145
+ [K in keyof ITestShape["whens"]]: (...Iw: ITestShape["whens"][K]) => (zel: ISelection) => IWhenShape;
146
+ };
147
+ Thens: {
148
+ [K in keyof ITestShape["thens"]]: (...It: ITestShape["thens"][K]) => (ssel: ISelection) => IThenShape;
149
+ };
150
+ Checks: {
151
+ [K in keyof ITestShape["checks"]]: (...Ic: ITestShape["checks"][K]) => IState;
152
+ };
153
+ };
154
+ type ITestArtifactory = (key: string, value: string) => unknown;
155
+ type ITLog = (...string: any[]) => void;
156
+ export abstract class BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITestShape extends ITTestShape, IFeatureShape> {
157
+ name: string;
158
+ givens: BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>[];
159
+ checks: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITestShape, IFeatureShape>[];
160
+ store: IStore;
161
+ fails: BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>[];
162
+ testResourceConfiguration: ITTestResourceConfiguration;
163
+ constructor(name: string, givens?: BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>[], checks?: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITestShape, IFeatureShape>[]);
164
+ toObj(): {
165
+ name: string;
166
+ givens: {
167
+ name: string;
168
+ whens: {
169
+ name: string;
170
+ error: boolean;
171
+ }[];
172
+ thens: {
173
+ name: string;
174
+ error: boolean;
175
+ }[];
176
+ errors: Error;
177
+ features: (keyof IFeatureShape)[];
178
+ }[];
179
+ fails: BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>[];
180
+ };
181
+ setup(s: IInput, artifactory: ITestArtifactory): Promise<ISubject>;
182
+ test(t: IThenShape): unknown;
183
+ run(input: any, testResourceConfiguration: ITTestResourceConfiguration, artifactory: (gndex: string) => (a: string, b: string) => void, tLog: (...string: any[]) => void): Promise<BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITestShape, IFeatureShape>>;
184
+ }
185
+ export abstract class BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape> {
186
+ name: string;
187
+ features: (keyof IFeatureShape)[];
188
+ whens: BaseWhen<IStore, ISelection, IThenShape>[];
189
+ thens: BaseThen<ISelection, IStore, IThenShape>[];
190
+ error: Error;
191
+ store: IStore;
192
+ recommendedFsPath: string;
193
+ constructor(name: string, features: (keyof IFeatureShape)[], whens: BaseWhen<IStore, ISelection, IThenShape>[], thens: BaseThen<ISelection, IStore, IThenShape>[]);
194
+ afterAll(store: IStore, artifactory: ITestArtifactory): void;
195
+ toObj(): {
196
+ name: string;
197
+ whens: {
198
+ name: string;
199
+ error: boolean;
200
+ }[];
201
+ thens: {
202
+ name: string;
203
+ error: boolean;
204
+ }[];
205
+ errors: Error;
206
+ features: (keyof IFeatureShape)[];
207
+ };
208
+ abstract givenThat(subject: ISubject, testResourceConfiguration: any, artifactory: ITestArtifactory): Promise<IStore>;
209
+ afterEach(store: IStore, ndx: number, artifactory: ITestArtifactory): Promise<unknown>;
210
+ give(subject: ISubject, index: number, testResourceConfiguration: any, tester: any, artifactory: ITestArtifactory, tLog: ITLog): Promise<IStore>;
211
+ }
212
+ export abstract class BaseWhen<IStore, ISelection, IThenShape> {
213
+ name: string;
214
+ actioner: (x: ISelection) => IThenShape;
215
+ error: boolean;
216
+ constructor(name: string, actioner: (xyz: ISelection) => IThenShape);
217
+ abstract andWhen(store: IStore, actioner: (x: ISelection) => IThenShape, testResource: any): any;
218
+ toObj(): {
219
+ name: string;
220
+ error: boolean;
221
+ };
222
+ test(store: IStore, testResourceConfiguration: any, tLog: ITLog): Promise<any>;
223
+ }
224
+ export abstract class BaseThen<ISelection, IStore, IThenShape> {
225
+ name: string;
226
+ thenCB: (storeState: ISelection) => IThenShape;
227
+ error: boolean;
228
+ constructor(name: string, thenCB: (val: ISelection) => IThenShape);
229
+ toObj(): {
230
+ name: string;
231
+ error: boolean;
232
+ };
233
+ abstract butThen(store: any, testResourceConfiguration?: any): Promise<ISelection>;
234
+ test(store: IStore, testResourceConfiguration: any, tLog: ITLog): Promise<IThenShape | undefined>;
235
+ }
236
+ export abstract class BaseCheck<ISubject, IStore, ISelection, IThenShape, ITestShape extends ITTestShape, IFeatureShape> {
237
+ name: string;
238
+ features: (keyof IFeatureShape)[];
239
+ checkCB: (whens: any, thens: any) => any;
240
+ whens: {
241
+ [K in keyof ITestShape["whens"]]: (p: any, tc: any) => BaseWhen<IStore, ISelection, IThenShape>;
242
+ };
243
+ thens: {
244
+ [K in keyof ITestShape["thens"]]: (p: any, tc: any) => BaseThen<ISelection, IStore, IThenShape>;
245
+ };
246
+ constructor(name: string, features: (keyof IFeatureShape)[], checkCB: (whens: any, thens: any) => any, whens: any, thens: any);
247
+ abstract checkThat(subject: ISubject, testResourceConfiguration: any, artifactory: ITestArtifactory): Promise<IStore>;
248
+ afterEach(store: IStore, ndx: number, cb?: any): Promise<unknown>;
249
+ check(subject: ISubject, ndx: number, testResourceConfiguration: any, tester: any, artifactory: ITestArtifactory, tLog: ITLog): Promise<void>;
250
+ }
251
+ export abstract class TesterantoLevelZero<IInput, ISubject, IStore, ISelection, SuiteExtensions, GivenExtensions, WhenExtensions, ThenExtensions, CheckExtensions, IThenShape, IFeatureShape> {
252
+ readonly cc: IStore;
253
+ constructorator: IStore;
254
+ suitesOverrides: Record<keyof SuiteExtensions, (name: string, givens: BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>[], checks: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITTestShape, IFeatureShape>[]) => BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITTestShape, IFeatureShape>>;
255
+ givenOverides: Record<keyof GivenExtensions, (name: string, features: (keyof IFeatureShape)[], whens: BaseWhen<IStore, ISelection, IThenShape>[], thens: BaseThen<ISelection, IStore, IThenShape>[], ...xtraArgs: any[]) => BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>>;
256
+ whenOverides: Record<keyof WhenExtensions, (any: any) => BaseWhen<IStore, ISelection, IThenShape>>;
257
+ thenOverides: Record<keyof ThenExtensions, (selection: ISelection, expectation: any) => BaseThen<ISelection, IStore, IThenShape>>;
258
+ checkOverides: Record<keyof CheckExtensions, (feature: string, callback: (whens: any, thens: any) => any, ...xtraArgs: any[]) => BaseCheck<ISubject, IStore, ISelection, IThenShape, ITTestShape, IFeatureShape>>;
259
+ constructor(cc: IStore, suitesOverrides: Record<keyof SuiteExtensions, (name: string, givens: BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>[], checks: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITTestShape, IFeatureShape>[]) => BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITTestShape, IFeatureShape>>, givenOverides: Record<keyof GivenExtensions, (name: string, features: (keyof IFeatureShape)[], whens: BaseWhen<IStore, ISelection, IThenShape>[], thens: BaseThen<ISelection, IStore, IThenShape>[], ...xtraArgs: any[]) => BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>>, whenOverides: Record<keyof WhenExtensions, (c: any) => BaseWhen<IStore, ISelection, IThenShape>>, thenOverides: Record<keyof ThenExtensions, (selection: ISelection, expectation: any) => BaseThen<ISelection, IStore, IThenShape>>, checkOverides: Record<keyof CheckExtensions, (feature: string, callback: (whens: any, thens: any) => any, ...xtraArgs: any[]) => BaseCheck<ISubject, IStore, ISelection, IThenShape, ITTestShape, IFeatureShape>>);
260
+ Suites(): Record<keyof SuiteExtensions, (name: string, givens: BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>[], checks: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITTestShape, IFeatureShape>[]) => BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITTestShape, IFeatureShape>>;
261
+ Given(): Record<keyof GivenExtensions, (name: string, features: (keyof IFeatureShape)[], whens: BaseWhen<IStore, ISelection, IThenShape>[], thens: BaseThen<ISelection, IStore, IThenShape>[], ...xtraArgs: any[]) => BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>>;
262
+ When(): Record<keyof WhenExtensions, (arg0: IStore, ...arg1: any) => BaseWhen<IStore, ISelection, IThenShape>>;
263
+ Then(): Record<keyof ThenExtensions, (selection: ISelection, expectation: any) => BaseThen<ISelection, IStore, IThenShape>>;
264
+ Check(): Record<keyof CheckExtensions, (feature: string, callback: (whens: any, thens: any) => any, whens: any, thens: any) => BaseCheck<ISubject, IStore, ISelection, IThenShape, ITTestShape, IFeatureShape>>;
265
+ }
266
+ export abstract class TesterantoLevelOne<ITestShape extends ITTestShape, IInitialState, ISelection, IStore, ISubject, IWhenShape, IThenShape, IInput, IFeatureShape extends Record<string, BaseFeature>> {
267
+ constructor(testImplementation: ITestImplementation<IInitialState, ISelection, IWhenShape, IThenShape, ITestShape>, testSpecification: (Suite: {
268
+ [K in keyof ITestShape["suites"]]: (feature: string, givens: BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>[], checks: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITestShape, IFeatureShape>[]) => BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITestShape, IFeatureShape>;
269
+ }, Given: {
270
+ [K in keyof ITestShape["givens"]]: (name: string, features: (keyof IFeatureShape)[], whens: BaseWhen<IStore, ISelection, IThenShape>[], thens: BaseThen<ISelection, IStore, IThenShape>[], ...a: ITestShape["givens"][K]) => BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>;
271
+ }, When: {
272
+ [K in keyof ITestShape["whens"]]: (...a: ITestShape["whens"][K]) => BaseWhen<IStore, ISelection, IThenShape>;
273
+ }, Then: {
274
+ [K in keyof ITestShape["thens"]]: (...a: ITestShape["thens"][K]) => BaseThen<ISelection, IStore, IThenShape>;
275
+ }, Check: {
276
+ [K in keyof ITestShape["checks"]]: (name: string, features: (keyof IFeatureShape)[], cbz: (...any: any[]) => Promise<void>) => any;
277
+ }) => BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITestShape, IFeatureShape>[], input: IInput, suiteKlasser: (name: string, givens: BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>[], checks: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITestShape, IFeatureShape>[]) => BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITestShape, IFeatureShape>, givenKlasser: (n: any, f: any, w: any, t: any, z?: any) => BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>, whenKlasser: (s: any, o: any) => BaseWhen<IStore, ISelection, IThenShape>, thenKlasser: (s: any, o: any) => BaseThen<IStore, ISelection, IThenShape>, checkKlasser: (n: any, f: any, cb: any, w: any, t: any) => BaseCheck<ISubject, IStore, ISelection, IThenShape, ITestShape, IFeatureShape>, testResourceRequirement: any, nameKey: string);
278
+ }
279
+ type ITestArtificer = (key: string, data: any) => void;
280
+ const _default: <TestShape extends ITTestShape, Input, Subject, Store, Selection_1, WhenShape, ThenShape, InitialStateShape, IFeatureShape extends Record<string, BaseFeature>>(input: Input, testSpecification: ITestSpecification<TestShape, IFeatureShape>, testImplementation: any, testInterface: {
281
+ actionHandler?: ((b: (...any: any[]) => any) => any) | undefined;
282
+ andWhen: (store: Store, actioner: any, testResource: ITTestResourceConfiguration) => Promise<Selection_1>;
283
+ butThen?: ((store: Store, callback: any, testResource: ITTestResourceConfiguration) => Promise<Selection_1>) | undefined;
284
+ assertioner?: ((t: ThenShape) => any) | undefined;
285
+ afterAll?: ((store: Store, artificer: ITestArtificer) => any) | undefined;
286
+ afterEach?: ((store: Store, ndx: number, artificer: ITestArtificer) => Promise<unknown>) | undefined;
287
+ beforeAll?: ((input: Input, artificer: ITestArtificer) => Promise<Subject>) | undefined;
288
+ beforeEach?: ((subject: Subject, initialValues: any, testResource: ITTestResourceConfiguration, artificer: ITestArtificer) => Promise<Store>) | undefined;
289
+ }, nameKey: string, testResourceRequirement?: ITTestResourceRequirement) => Promise<void>;
290
+ export default _default;
291
+ }
292
+ declare module "Project" {
293
+ import pm2 from 'pm2';
294
+ import { TesterantoFeatures } from "Features";
295
+ import { ICollateMode } from "IBaseConfig";
296
+ import { IBaseConfig } from "index";
297
+ type IPm2Process = {
298
+ process: {
299
+ namespace: string;
300
+ versioning: object;
301
+ name: string;
302
+ pm_id: number;
303
+ };
304
+ data: {
305
+ testResourceRequirement: {
306
+ ports: number;
307
+ };
308
+ };
309
+ at: string;
310
+ };
311
+ export default class Scheduler {
312
+ project: ITProject;
313
+ ports: Record<string, string>;
314
+ jobs: Record<string, {
315
+ aborter: () => any;
316
+ cancellablePromise: string;
317
+ }>;
318
+ queue: IPm2Process[];
319
+ spinCycle: number;
320
+ spinAnimation: string;
321
+ pm2: typeof pm2;
322
+ summary: Record<string, boolean | undefined>;
323
+ mode: `up` | `down`;
324
+ constructor(project: ITProject);
325
+ private checkForShutDown;
326
+ abort(pm2Proc: IPm2Process): Promise<void>;
327
+ private spinner;
328
+ private push;
329
+ private pop;
330
+ private releaseTestResources;
331
+ shutdown(): void;
332
+ }
333
+ export class ITProject {
334
+ buildMode: 'on' | 'off' | 'watch';
335
+ clearScreen: boolean;
336
+ collateEntry: string;
337
+ collateMode: ICollateMode;
338
+ features: TesterantoFeatures;
339
+ loaders: any[];
340
+ minify: boolean;
341
+ outbase: string;
342
+ outdir: string;
343
+ ports: string[];
344
+ runMode: boolean;
345
+ tests: string[];
346
+ getEntryPoints(): string[];
347
+ constructor(config: IBaseConfig);
348
+ }
349
+ }
350
+ declare module "kokomoFeatures" {
351
+ import { BaseFeature, TesterantoFeatures } from "Features";
352
+ export class MyFeature extends BaseFeature {
353
+ due?: Date;
354
+ constructor(name: string, due?: Date);
355
+ }
356
+ export const features: {
357
+ root: MyFeature;
358
+ mint: MyFeature;
359
+ redemption: MyFeature;
360
+ federatedSplitContract: MyFeature;
361
+ markRedeemed: MyFeature;
362
+ encryptShipping: MyFeature;
363
+ decryptShipping: MyFeature;
364
+ buildSilo: MyFeature;
365
+ buildRocket: MyFeature;
366
+ buildSatellite: MyFeature;
367
+ hello: MyFeature;
368
+ aloha: MyFeature;
369
+ gutentag: MyFeature;
370
+ buenosDias: MyFeature;
371
+ hola: MyFeature;
372
+ bienVenidos: MyFeature;
373
+ walkingTheDog: MyFeature;
374
+ };
375
+ const _default_1: TesterantoFeatures;
376
+ export default _default_1;
377
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "testeranto",
3
3
  "description": "teeny tiny tightly-typed typescript tests",
4
- "version": "0.36.3",
4
+ "version": "0.37.1",
5
5
  "type": "module",
6
6
  "types": "./src/index.d.mts",
7
7
  "main": "./src/index.mts",
package/src/index.d.mts CHANGED
@@ -13,8 +13,8 @@ declare type IRunner = (x: ITTestResourceConfiguration, t: ITLog) => Promise<boo
13
13
  export declare type IT = {
14
14
  toObj(): object;
15
15
  name: string;
16
- givens: BaseGiven<unknown, unknown, unknown, unknown, Record<string, BaseFeature>>[];
17
- checks: BaseCheck<unknown, unknown, unknown, unknown, ITTestShape, unknown>[];
16
+ givens: BaseGiven<unknown, unknown, unknown, unknown>[];
17
+ checks: BaseCheck<unknown, unknown, unknown, unknown, ITTestShape>[];
18
18
  testResourceConfiguration: ITTestResourceConfiguration;
19
19
  };
20
20
  export declare type ITestJob = {
@@ -34,20 +34,20 @@ export declare type ITTestShape = {
34
34
  thens: any;
35
35
  checks: any;
36
36
  };
37
- export declare type ITestSpecification<ITestShape extends ITTestShape, IFeatureShape> = (Suite: {
38
- [K in keyof ITestShape["suites"]]: (name: string, givens: BaseGiven<unknown, unknown, unknown, unknown, Record<string, BaseFeature>>[], checks: BaseCheck<unknown, unknown, unknown, unknown, ITestShape, IFeatureShape>[]) => BaseSuite<unknown, unknown, unknown, unknown, unknown, ITestShape, IFeatureShape>;
37
+ export declare type ITestSpecification<ITestShape extends ITTestShape> = (Suite: {
38
+ [K in keyof ITestShape["suites"]]: (name: string, givens: BaseGiven<unknown, unknown, unknown, unknown>[], checks: BaseCheck<unknown, unknown, unknown, unknown, ITestShape>[]) => BaseSuite<unknown, unknown, unknown, unknown, unknown, ITestShape>;
39
39
  }, Given: {
40
- [K in keyof ITestShape["givens"]]: (features: (keyof IFeatureShape)[], whens: BaseWhen<unknown, unknown, unknown>[], thens: BaseThen<unknown, unknown, unknown>[], ...xtras: ITestShape["givens"][K]) => BaseGiven<unknown, unknown, unknown, unknown, unknown>;
40
+ [K in keyof ITestShape["givens"]]: (features: string[], whens: BaseWhen<unknown, unknown, unknown>[], thens: BaseThen<unknown, unknown, unknown>[], ...xtras: ITestShape["givens"][K]) => BaseGiven<unknown, unknown, unknown, unknown>;
41
41
  }, When: {
42
42
  [K in keyof ITestShape["whens"]]: (...xtras: ITestShape["whens"][K]) => BaseWhen<unknown, unknown, unknown>;
43
43
  }, Then: {
44
44
  [K in keyof ITestShape["thens"]]: (...xtras: ITestShape["thens"][K]) => BaseThen<unknown, unknown, unknown>;
45
45
  }, Check: {
46
- [K in keyof ITestShape["checks"]]: (name: string, features: (keyof IFeatureShape)[], callbackA: (whens: {
46
+ [K in keyof ITestShape["checks"]]: (name: string, features: string[], callbackA: (whens: {
47
47
  [K in keyof ITestShape["whens"]]: (...unknown: any[]) => BaseWhen<unknown, unknown, unknown>;
48
48
  }, thens: {
49
49
  [K in keyof ITestShape["thens"]]: (...unknown: any[]) => BaseThen<unknown, unknown, unknown>;
50
- }) => unknown, ...xtras: ITestShape["checks"][K]) => BaseCheck<unknown, unknown, unknown, unknown, ITestShape, IFeatureShape>;
50
+ }) => unknown, ...xtras: ITestShape["checks"][K]) => BaseCheck<unknown, unknown, unknown, unknown, ITestShape>;
51
51
  }) => any[];
52
52
  export declare type ITestImplementation<IState, ISelection, IWhenShape, IThenShape, ITestShape extends ITTestShape> = {
53
53
  Suites: {
@@ -68,14 +68,14 @@ export declare type ITestImplementation<IState, ISelection, IWhenShape, IThenSha
68
68
  };
69
69
  declare type ITestArtifactory = (key: string, value: string) => unknown;
70
70
  declare type ITLog = (...string: any[]) => void;
71
- export declare abstract class BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITestShape extends ITTestShape, IFeatureShape> {
71
+ export declare abstract class BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITestShape extends ITTestShape> {
72
72
  name: string;
73
- givens: BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>[];
74
- checks: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITestShape, IFeatureShape>[];
73
+ givens: BaseGiven<ISubject, IStore, ISelection, IThenShape>[];
74
+ checks: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITestShape>[];
75
75
  store: IStore;
76
- fails: BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>[];
76
+ fails: BaseGiven<ISubject, IStore, ISelection, IThenShape>[];
77
77
  testResourceConfiguration: ITTestResourceConfiguration;
78
- constructor(name: string, givens?: BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>[], checks?: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITestShape, IFeatureShape>[]);
78
+ constructor(name: string, givens?: BaseGiven<ISubject, IStore, ISelection, IThenShape>[], checks?: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITestShape>[]);
79
79
  toObj(): {
80
80
  name: string;
81
81
  givens: {
@@ -89,23 +89,23 @@ export declare abstract class BaseSuite<IInput, ISubject, IStore, ISelection, IT
89
89
  error: boolean;
90
90
  }[];
91
91
  errors: Error;
92
- features: (keyof IFeatureShape)[];
92
+ features: string[];
93
93
  }[];
94
- fails: BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>[];
94
+ fails: BaseGiven<ISubject, IStore, ISelection, IThenShape>[];
95
95
  };
96
96
  setup(s: IInput, artifactory: ITestArtifactory): Promise<ISubject>;
97
97
  test(t: IThenShape): unknown;
98
- run(input: any, testResourceConfiguration: ITTestResourceConfiguration, artifactory: (gndex: string) => (a: string, b: string) => void, tLog: (...string: any[]) => void): Promise<BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITestShape, IFeatureShape>>;
98
+ run(input: any, testResourceConfiguration: ITTestResourceConfiguration, artifactory: (gndex: string) => (a: string, b: string) => void, tLog: (...string: any[]) => void): Promise<BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITestShape>>;
99
99
  }
100
- export declare abstract class BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape> {
100
+ export declare abstract class BaseGiven<ISubject, IStore, ISelection, IThenShape> {
101
101
  name: string;
102
- features: (keyof IFeatureShape)[];
102
+ features: string[];
103
103
  whens: BaseWhen<IStore, ISelection, IThenShape>[];
104
104
  thens: BaseThen<ISelection, IStore, IThenShape>[];
105
105
  error: Error;
106
106
  store: IStore;
107
107
  recommendedFsPath: string;
108
- constructor(name: string, features: (keyof IFeatureShape)[], whens: BaseWhen<IStore, ISelection, IThenShape>[], thens: BaseThen<ISelection, IStore, IThenShape>[]);
108
+ constructor(name: string, features: string[], whens: BaseWhen<IStore, ISelection, IThenShape>[], thens: BaseThen<ISelection, IStore, IThenShape>[]);
109
109
  afterAll(store: IStore, artifactory: ITestArtifactory): void;
110
110
  toObj(): {
111
111
  name: string;
@@ -118,7 +118,7 @@ export declare abstract class BaseGiven<ISubject, IStore, ISelection, IThenShape
118
118
  error: boolean;
119
119
  }[];
120
120
  errors: Error;
121
- features: (keyof IFeatureShape)[];
121
+ features: string[];
122
122
  };
123
123
  abstract givenThat(subject: ISubject, testResourceConfiguration: any, artifactory: ITestArtifactory): Promise<IStore>;
124
124
  afterEach(store: IStore, ndx: number, artifactory: ITestArtifactory): Promise<unknown>;
@@ -148,9 +148,9 @@ export declare abstract class BaseThen<ISelection, IStore, IThenShape> {
148
148
  abstract butThen(store: any, testResourceConfiguration?: any): Promise<ISelection>;
149
149
  test(store: IStore, testResourceConfiguration: any, tLog: ITLog): Promise<IThenShape | undefined>;
150
150
  }
151
- export declare abstract class BaseCheck<ISubject, IStore, ISelection, IThenShape, ITestShape extends ITTestShape, IFeatureShape> {
151
+ export declare abstract class BaseCheck<ISubject, IStore, ISelection, IThenShape, ITestShape extends ITTestShape> {
152
152
  name: string;
153
- features: (keyof IFeatureShape)[];
153
+ features: string[];
154
154
  checkCB: (whens: any, thens: any) => any;
155
155
  whens: {
156
156
  [K in keyof ITestShape["whens"]]: (p: any, tc: any) => BaseWhen<IStore, ISelection, IThenShape>;
@@ -158,41 +158,41 @@ export declare abstract class BaseCheck<ISubject, IStore, ISelection, IThenShape
158
158
  thens: {
159
159
  [K in keyof ITestShape["thens"]]: (p: any, tc: any) => BaseThen<ISelection, IStore, IThenShape>;
160
160
  };
161
- constructor(name: string, features: (keyof IFeatureShape)[], checkCB: (whens: any, thens: any) => any, whens: any, thens: any);
161
+ constructor(name: string, features: string[], checkCB: (whens: any, thens: any) => any, whens: any, thens: any);
162
162
  abstract checkThat(subject: ISubject, testResourceConfiguration: any, artifactory: ITestArtifactory): Promise<IStore>;
163
163
  afterEach(store: IStore, ndx: number, cb?: any): Promise<unknown>;
164
164
  check(subject: ISubject, ndx: number, testResourceConfiguration: any, tester: any, artifactory: ITestArtifactory, tLog: ITLog): Promise<void>;
165
165
  }
166
- export declare abstract class TesterantoLevelZero<IInput, ISubject, IStore, ISelection, SuiteExtensions, GivenExtensions, WhenExtensions, ThenExtensions, CheckExtensions, IThenShape, IFeatureShape> {
166
+ export declare abstract class TesterantoLevelZero<IInput, ISubject, IStore, ISelection, SuiteExtensions, GivenExtensions, WhenExtensions, ThenExtensions, CheckExtensions, IThenShape> {
167
167
  readonly cc: IStore;
168
168
  constructorator: IStore;
169
- suitesOverrides: Record<keyof SuiteExtensions, (name: string, givens: BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>[], checks: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITTestShape, IFeatureShape>[]) => BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITTestShape, IFeatureShape>>;
170
- givenOverides: Record<keyof GivenExtensions, (name: string, features: (keyof IFeatureShape)[], whens: BaseWhen<IStore, ISelection, IThenShape>[], thens: BaseThen<ISelection, IStore, IThenShape>[], ...xtraArgs: any[]) => BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>>;
169
+ suitesOverrides: Record<keyof SuiteExtensions, (name: string, givens: BaseGiven<ISubject, IStore, ISelection, IThenShape>[], checks: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITTestShape>[]) => BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITTestShape>>;
170
+ givenOverides: Record<keyof GivenExtensions, (name: string, features: string[], whens: BaseWhen<IStore, ISelection, IThenShape>[], thens: BaseThen<ISelection, IStore, IThenShape>[], ...xtraArgs: any[]) => BaseGiven<ISubject, IStore, ISelection, IThenShape>>;
171
171
  whenOverides: Record<keyof WhenExtensions, (any: any) => BaseWhen<IStore, ISelection, IThenShape>>;
172
172
  thenOverides: Record<keyof ThenExtensions, (selection: ISelection, expectation: any) => BaseThen<ISelection, IStore, IThenShape>>;
173
- checkOverides: Record<keyof CheckExtensions, (feature: string, callback: (whens: any, thens: any) => any, ...xtraArgs: any[]) => BaseCheck<ISubject, IStore, ISelection, IThenShape, ITTestShape, IFeatureShape>>;
174
- constructor(cc: IStore, suitesOverrides: Record<keyof SuiteExtensions, (name: string, givens: BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>[], checks: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITTestShape, IFeatureShape>[]) => BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITTestShape, IFeatureShape>>, givenOverides: Record<keyof GivenExtensions, (name: string, features: (keyof IFeatureShape)[], whens: BaseWhen<IStore, ISelection, IThenShape>[], thens: BaseThen<ISelection, IStore, IThenShape>[], ...xtraArgs: any[]) => BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>>, whenOverides: Record<keyof WhenExtensions, (c: any) => BaseWhen<IStore, ISelection, IThenShape>>, thenOverides: Record<keyof ThenExtensions, (selection: ISelection, expectation: any) => BaseThen<ISelection, IStore, IThenShape>>, checkOverides: Record<keyof CheckExtensions, (feature: string, callback: (whens: any, thens: any) => any, ...xtraArgs: any[]) => BaseCheck<ISubject, IStore, ISelection, IThenShape, ITTestShape, IFeatureShape>>);
175
- Suites(): Record<keyof SuiteExtensions, (name: string, givens: BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>[], checks: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITTestShape, IFeatureShape>[]) => BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITTestShape, IFeatureShape>>;
176
- Given(): Record<keyof GivenExtensions, (name: string, features: (keyof IFeatureShape)[], whens: BaseWhen<IStore, ISelection, IThenShape>[], thens: BaseThen<ISelection, IStore, IThenShape>[], ...xtraArgs: any[]) => BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>>;
173
+ checkOverides: Record<keyof CheckExtensions, (feature: string, callback: (whens: any, thens: any) => any, ...xtraArgs: any[]) => BaseCheck<ISubject, IStore, ISelection, IThenShape, ITTestShape>>;
174
+ constructor(cc: IStore, suitesOverrides: Record<keyof SuiteExtensions, (name: string, givens: BaseGiven<ISubject, IStore, ISelection, IThenShape>[], checks: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITTestShape>[]) => BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITTestShape>>, givenOverides: Record<keyof GivenExtensions, (name: string, features: string[], whens: BaseWhen<IStore, ISelection, IThenShape>[], thens: BaseThen<ISelection, IStore, IThenShape>[], ...xtraArgs: any[]) => BaseGiven<ISubject, IStore, ISelection, IThenShape>>, whenOverides: Record<keyof WhenExtensions, (c: any) => BaseWhen<IStore, ISelection, IThenShape>>, thenOverides: Record<keyof ThenExtensions, (selection: ISelection, expectation: any) => BaseThen<ISelection, IStore, IThenShape>>, checkOverides: Record<keyof CheckExtensions, (feature: string, callback: (whens: any, thens: any) => any, ...xtraArgs: any[]) => BaseCheck<ISubject, IStore, ISelection, IThenShape, ITTestShape>>);
175
+ Suites(): Record<keyof SuiteExtensions, (name: string, givens: BaseGiven<ISubject, IStore, ISelection, IThenShape>[], checks: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITTestShape>[]) => BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITTestShape>>;
176
+ Given(): Record<keyof GivenExtensions, (name: string, features: string[], whens: BaseWhen<IStore, ISelection, IThenShape>[], thens: BaseThen<ISelection, IStore, IThenShape>[], ...xtraArgs: any[]) => BaseGiven<ISubject, IStore, ISelection, IThenShape>>;
177
177
  When(): Record<keyof WhenExtensions, (arg0: IStore, ...arg1: any) => BaseWhen<IStore, ISelection, IThenShape>>;
178
178
  Then(): Record<keyof ThenExtensions, (selection: ISelection, expectation: any) => BaseThen<ISelection, IStore, IThenShape>>;
179
- Check(): Record<keyof CheckExtensions, (feature: string, callback: (whens: any, thens: any) => any, whens: any, thens: any) => BaseCheck<ISubject, IStore, ISelection, IThenShape, ITTestShape, IFeatureShape>>;
179
+ Check(): Record<keyof CheckExtensions, (feature: string, callback: (whens: any, thens: any) => any, whens: any, thens: any) => BaseCheck<ISubject, IStore, ISelection, IThenShape, ITTestShape>>;
180
180
  }
181
181
  export declare abstract class TesterantoLevelOne<ITestShape extends ITTestShape, IInitialState, ISelection, IStore, ISubject, IWhenShape, IThenShape, IInput, IFeatureShape extends Record<string, BaseFeature>> {
182
182
  constructor(testImplementation: ITestImplementation<IInitialState, ISelection, IWhenShape, IThenShape, ITestShape>, testSpecification: (Suite: {
183
- [K in keyof ITestShape["suites"]]: (feature: string, givens: BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>[], checks: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITestShape, IFeatureShape>[]) => BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITestShape, IFeatureShape>;
183
+ [K in keyof ITestShape["suites"]]: (feature: string, givens: BaseGiven<ISubject, IStore, ISelection, IThenShape>[], checks: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITestShape>[]) => BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITestShape>;
184
184
  }, Given: {
185
- [K in keyof ITestShape["givens"]]: (name: string, features: (keyof IFeatureShape)[], whens: BaseWhen<IStore, ISelection, IThenShape>[], thens: BaseThen<ISelection, IStore, IThenShape>[], ...a: ITestShape["givens"][K]) => BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>;
185
+ [K in keyof ITestShape["givens"]]: (name: string, features: string[], whens: BaseWhen<IStore, ISelection, IThenShape>[], thens: BaseThen<ISelection, IStore, IThenShape>[], ...a: ITestShape["givens"]) => BaseGiven<ISubject, IStore, ISelection, IThenShape>;
186
186
  }, When: {
187
187
  [K in keyof ITestShape["whens"]]: (...a: ITestShape["whens"][K]) => BaseWhen<IStore, ISelection, IThenShape>;
188
188
  }, Then: {
189
189
  [K in keyof ITestShape["thens"]]: (...a: ITestShape["thens"][K]) => BaseThen<ISelection, IStore, IThenShape>;
190
190
  }, Check: {
191
- [K in keyof ITestShape["checks"]]: (name: string, features: (keyof IFeatureShape)[], cbz: (...any: any[]) => Promise<void>) => any;
192
- }) => BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITestShape, IFeatureShape>[], input: IInput, suiteKlasser: (name: string, givens: BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>[], checks: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITestShape, IFeatureShape>[]) => BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITestShape, IFeatureShape>, givenKlasser: (n: any, f: any, w: any, t: any, z?: any) => BaseGiven<ISubject, IStore, ISelection, IThenShape, IFeatureShape>, whenKlasser: (s: any, o: any) => BaseWhen<IStore, ISelection, IThenShape>, thenKlasser: (s: any, o: any) => BaseThen<IStore, ISelection, IThenShape>, checkKlasser: (n: any, f: any, cb: any, w: any, t: any) => BaseCheck<ISubject, IStore, ISelection, IThenShape, ITestShape, IFeatureShape>, testResourceRequirement: any, nameKey: string);
191
+ [K in keyof ITestShape["checks"]]: (name: string, features: string[], cbz: (...any: any[]) => Promise<void>) => any;
192
+ }) => BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITestShape>[], input: IInput, suiteKlasser: (name: string, givens: BaseGiven<ISubject, IStore, ISelection, IThenShape>[], checks: BaseCheck<ISubject, IStore, ISelection, IThenShape, ITestShape>[]) => BaseSuite<IInput, ISubject, IStore, ISelection, IThenShape, ITestShape>, givenKlasser: (n: any, f: any, w: any, t: any, z?: any) => BaseGiven<ISubject, IStore, ISelection, IThenShape>, whenKlasser: (s: any, o: any) => BaseWhen<IStore, ISelection, IThenShape>, thenKlasser: (s: any, o: any) => BaseThen<IStore, ISelection, IThenShape>, checkKlasser: (n: any, f: any, cb: any, w: any, t: any) => BaseCheck<ISubject, IStore, ISelection, IThenShape, ITestShape>, testResourceRequirement: any, nameKey: string);
193
193
  }
194
194
  declare type ITestArtificer = (key: string, data: any) => void;
195
- declare const _default: <TestShape extends ITTestShape, Input, Subject, Store, Selection_1, WhenShape, ThenShape, InitialStateShape, IFeatureShape extends Record<string, BaseFeature>>(input: Input, testSpecification: ITestSpecification<TestShape, IFeatureShape>, testImplementation: any, testInterface: {
195
+ declare const _default: <TestShape extends ITTestShape, Input, Subject, Store, Selection_1, WhenShape, ThenShape, InitialStateShape, IFeatureShape extends Record<string, BaseFeature>>(input: Input, testSpecification: ITestSpecification<TestShape>, testImplementation: any, testInterface: {
196
196
  actionHandler?: ((b: (...any: any[]) => any) => any) | undefined;
197
197
  andWhen: (store: Store, actioner: any, testResource: ITTestResourceConfiguration) => Promise<Selection_1>;
198
198
  butThen?: ((store: Store, callback: any, testResource: ITTestResourceConfiguration) => Promise<Selection_1>) | undefined;
package/src/index.mjs CHANGED
@@ -411,12 +411,11 @@ export default async (input, testSpecification, testImplementation, testInterfac
411
411
  const testResourceArg = process.argv[2] || `{}`;
412
412
  try {
413
413
  const partialTestResource = JSON.parse(testResourceArg);
414
- if (partialTestResource.fs) {
414
+ if (partialTestResource.fs && partialTestResource.ports) {
415
415
  await t.receiveTestResourceConfig(partialTestResource);
416
416
  // process.exit(0); // :-)
417
417
  }
418
418
  else {
419
- console.log(partialTestResource);
420
419
  console.log("test configuration is incomplete");
421
420
  if (process.send) {
422
421
  console.log("requesting test resources from pm2 ...", testResourceRequirement);