testeranto 0.30.0 → 0.33.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.
@@ -1,7 +1,5 @@
1
1
  {
2
2
  "editor.formatOnSave": true,
3
3
  "editor.formatOnPaste": true,
4
- "cSpell.words": [
5
- "Testeranto"
6
- ]
7
- }
4
+ "cSpell.words": ["hola", "mothership", "Testeranto"]
5
+ }
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env sh
2
+
3
+ yarn tsc --module esnext --esModuleInterop --target esnext --moduleResolution node --outdir js; node $1
package/index.d.ts ADDED
@@ -0,0 +1,349 @@
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
+ }
@@ -0,0 +1 @@
1
+ {"bundle":{"commonSourceDirectory":"./src","sourceFiles":["./src/Features.ts","./src/IBaseConfig.ts","./src/index.mts","./src/Project.ts"],"dts":{"sections":[{"pos":0,"end":20095,"kind":"text"}],"hash":"be561fb43badcae0ccc7598c676a71b8293764d4a63ba2d25b8a52a93a9fc3ae"}},"version":"4.8.2"}
package/package.json CHANGED
@@ -1,10 +1,16 @@
1
1
  {
2
2
  "name": "testeranto",
3
3
  "description": "teeny tiny tightly-typed typescript tests",
4
- "version": "0.30.0",
4
+ "version": "0.33.0",
5
5
  "type": "module",
6
- "types": "./src/index.d.mts",
6
+ "types": "./index.d.mts",
7
7
  "main": "./src/index.mjs",
8
+ "exports": {
9
+ ".": "./src/index.mjs",
10
+ "./src/Project": "./src/Project.js",
11
+ "./src/Features": "./src/Features.js",
12
+ "./src/Report": "./src/Report.tsx"
13
+ },
8
14
  "repository": "git@github.com:adamwong246/testeranto.git",
9
15
  "homepage": "https://github.com/adamwong246/testeranto",
10
16
  "author": "adam wong <adamwong246@gmail.com>",
@@ -16,11 +22,11 @@
16
22
  "ATDD"
17
23
  ],
18
24
  "bin": {
19
- "testerantoReport": "./bin/report.sh",
20
- "testeranto": "./bin/testeranto.sh"
25
+ "testerantoRun": "./bin/testerantoRun.sh",
26
+ "testerantoWatch": "./bin/testerantoWatch.sh"
21
27
  },
22
28
  "scripts": {
23
- "build": "tsc",
29
+ "build": "tsc; yarn tsc --emitDeclarationOnly --isolatedModules false --outFile index.d.mts",
24
30
  "dev": "tsc --watch",
25
31
  "bundle:reporter": "esbuild ./src/Report.tsx --bundle --outfile=./dist/reporter.js",
26
32
  "simpleserver": "cd dist && python -m SimpleHTTPServer 8080",
@@ -39,6 +45,7 @@
39
45
  "@swc/core": "^1.3.26",
40
46
  "@types/node": "^18.14.0",
41
47
  "@types/react": "^18.0.21",
48
+ "@types/react-bootstrap": "^0.32.32",
42
49
  "@types/react-dom": "^18.0.6",
43
50
  "@typescript-eslint/eslint-plugin": "^5.46.0",
44
51
  "@typescript-eslint/parser": "^5.46.0",
@@ -52,12 +59,10 @@
52
59
  "graphology-dag": "^0.2.0",
53
60
  "graphology-types": "^0.24.5",
54
61
  "pm2": "^5.2.2",
55
- "react": "18.2.0",
56
62
  "react-bootstrap": "^2.7.0",
57
- "react-dom": "^18.2.0",
58
- "react-redux": "^8.0.4",
59
- "react-test-renderer": "^18.2.0",
60
63
  "ts-node": "^10.9.1",
61
- "typescript": "4.8.2"
64
+ "typescript": "4.8.2",
65
+ "why-is-node-running": "^2.2.2",
66
+ "why-is-node-still-running": "^1.0.0"
62
67
  }
63
- }
68
+ }
File without changes
@@ -0,0 +1,65 @@
1
+ declare const DirectedGraph: any, UndirectedGraph: any;
2
+ declare abstract class TesterantoGraph {
3
+ name: string;
4
+ abstract graph: any;
5
+ constructor(name: string);
6
+ }
7
+ export declare class BaseFeature {
8
+ name: string;
9
+ constructor(name: string);
10
+ }
11
+ export declare class TesterantoGraphUndirected implements TesterantoGraph {
12
+ name: string;
13
+ graph: typeof UndirectedGraph;
14
+ constructor(name: string);
15
+ connect(a: any, b: any, relation?: string): void;
16
+ }
17
+ export declare class TesterantoGraphDirected implements TesterantoGraph {
18
+ name: string;
19
+ graph: typeof DirectedGraph;
20
+ constructor(name: string);
21
+ connect(to: any, from: any, relation?: string): void;
22
+ }
23
+ export declare class TesterantoGraphDirectedAcyclic implements TesterantoGraph {
24
+ name: string;
25
+ graph: typeof DirectedGraph;
26
+ constructor(name: string);
27
+ connect(to: any, from: any, relation?: string): void;
28
+ }
29
+ export declare class TesterantoFeatures {
30
+ features: Record<string, BaseFeature>;
31
+ graphs: {
32
+ undirected: TesterantoGraphUndirected[];
33
+ directed: TesterantoGraphDirected[];
34
+ dags: TesterantoGraphDirectedAcyclic[];
35
+ };
36
+ constructor(features: Record<string, BaseFeature>, graphs: {
37
+ undirected: TesterantoGraphUndirected[];
38
+ directed: TesterantoGraphDirected[];
39
+ dags: TesterantoGraphDirectedAcyclic[];
40
+ });
41
+ networks(): (TesterantoGraphUndirected | TesterantoGraphDirected | TesterantoGraphDirectedAcyclic)[];
42
+ toObj(): {
43
+ features: {
44
+ inNetworks: {
45
+ network: string;
46
+ neighbors: any;
47
+ }[];
48
+ name: string;
49
+ }[];
50
+ networks: ({
51
+ name: string;
52
+ graph: any;
53
+ } | {
54
+ name: string;
55
+ graph: any;
56
+ } | {
57
+ name: string;
58
+ graph: any;
59
+ })[];
60
+ };
61
+ }
62
+ export declare type IT_FeatureNetwork = {
63
+ name: string;
64
+ };
65
+ export {};
@@ -0,0 +1,71 @@
1
+ import pkg from 'graphology';
2
+ /* @ts-ignore:next-line */
3
+ const { DirectedGraph, UndirectedGraph } = pkg;
4
+ class TesterantoGraph {
5
+ constructor(name) {
6
+ this.name = name;
7
+ }
8
+ }
9
+ export class BaseFeature {
10
+ constructor(name) {
11
+ this.name = name;
12
+ }
13
+ }
14
+ ;
15
+ export class TesterantoGraphUndirected {
16
+ constructor(name) {
17
+ this.name = name;
18
+ this.graph = new UndirectedGraph();
19
+ }
20
+ connect(a, b, relation) {
21
+ this.graph.mergeEdge(a, b, { type: relation });
22
+ }
23
+ }
24
+ export class TesterantoGraphDirected {
25
+ constructor(name) {
26
+ this.name = name;
27
+ this.graph = new DirectedGraph();
28
+ }
29
+ connect(to, from, relation) {
30
+ this.graph.mergeEdge(to, from, { type: relation });
31
+ }
32
+ }
33
+ export class TesterantoGraphDirectedAcyclic {
34
+ constructor(name) {
35
+ this.name = name;
36
+ this.graph = new DirectedGraph();
37
+ }
38
+ connect(to, from, relation) {
39
+ this.graph.mergeEdge(to, from, { type: relation });
40
+ }
41
+ }
42
+ export class TesterantoFeatures {
43
+ constructor(features, graphs) {
44
+ this.features = features;
45
+ this.graphs = graphs;
46
+ }
47
+ networks() {
48
+ return [
49
+ ...this.graphs.undirected.values(),
50
+ ...this.graphs.directed.values(),
51
+ ...this.graphs.dags.values()
52
+ ];
53
+ }
54
+ toObj() {
55
+ return {
56
+ features: Object.entries(this.features).map(([name, feature]) => {
57
+ return Object.assign(Object.assign({}, feature), { inNetworks: this.networks().filter((network) => {
58
+ return network.graph.hasNode(feature.name);
59
+ }).map((network) => {
60
+ return {
61
+ network: network.name,
62
+ neighbors: network.graph.neighbors(feature.name)
63
+ };
64
+ }) });
65
+ }),
66
+ networks: this.networks().map((network) => {
67
+ return Object.assign({}, network);
68
+ })
69
+ };
70
+ }
71
+ }
@@ -0,0 +1,114 @@
1
+ import pkg from 'graphology';
2
+
3
+ /* @ts-ignore:next-line */
4
+ const { DirectedGraph, UndirectedGraph } = pkg;
5
+
6
+ abstract class TesterantoGraph {
7
+ name: string;
8
+ abstract graph;
9
+
10
+ constructor(name: string) {
11
+ this.name = name;
12
+ }
13
+ }
14
+
15
+ export class BaseFeature {
16
+ name: string;
17
+ constructor(name: string) {
18
+ this.name = name;
19
+ }
20
+ };
21
+
22
+ export class TesterantoGraphUndirected implements TesterantoGraph {
23
+ name: string;
24
+ graph: typeof UndirectedGraph
25
+ constructor(name: string) {
26
+ this.name = name;
27
+ this.graph = new UndirectedGraph();
28
+ }
29
+ connect(a, b, relation?: string) {
30
+ this.graph.mergeEdge(a, b, { type: relation });
31
+ }
32
+ }
33
+
34
+ export class TesterantoGraphDirected implements TesterantoGraph {
35
+ name: string;
36
+ graph: typeof DirectedGraph;
37
+ constructor(name: string) {
38
+ this.name = name;
39
+ this.graph = new DirectedGraph();
40
+ }
41
+ connect(to, from, relation?: string) {
42
+ this.graph.mergeEdge(to, from, { type: relation });
43
+ }
44
+ }
45
+
46
+ export class TesterantoGraphDirectedAcyclic implements TesterantoGraph {
47
+ name: string;
48
+ graph: typeof DirectedGraph;
49
+ constructor(name: string) {
50
+ this.name = name;
51
+ this.graph = new DirectedGraph();
52
+ }
53
+ connect(to, from, relation?: string) {
54
+ this.graph.mergeEdge(to, from, { type: relation });
55
+ }
56
+ }
57
+
58
+ export class TesterantoFeatures {
59
+ features: Record<string, BaseFeature>;
60
+ graphs: {
61
+ undirected: TesterantoGraphUndirected[],
62
+ directed: TesterantoGraphDirected[],
63
+ dags: TesterantoGraphDirectedAcyclic[]
64
+ }
65
+
66
+ constructor(
67
+ features: Record<string, BaseFeature>,
68
+ graphs: {
69
+ undirected: TesterantoGraphUndirected[],
70
+ directed: TesterantoGraphDirected[],
71
+ dags: TesterantoGraphDirectedAcyclic[]
72
+ }
73
+ ) {
74
+ this.features = features;
75
+ this.graphs = graphs;
76
+ }
77
+
78
+ networks() {
79
+ return [
80
+ ...this.graphs.undirected.values(),
81
+ ...this.graphs.directed.values(),
82
+ ...this.graphs.dags.values()
83
+ ]
84
+ }
85
+
86
+ toObj() {
87
+ return {
88
+ features: Object.entries(this.features).map(([name, feature]) => {
89
+ return {
90
+ ...feature,
91
+ inNetworks: this.networks().filter((network) => {
92
+ return network.graph.hasNode(feature.name);
93
+ }).map((network) => {
94
+ return {
95
+
96
+ network: network.name,
97
+ neighbors: network.graph.neighbors(feature.name)
98
+ }
99
+ })
100
+ }
101
+ }),
102
+ networks: this.networks().map((network) => {
103
+ return {
104
+ ...network
105
+ }
106
+ })
107
+ };
108
+ }
109
+ }
110
+
111
+ export type IT_FeatureNetwork = {
112
+ name: string,
113
+ // graph: DirectedGraph
114
+ };