testeranto 0.134.0 → 0.135.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/.aider.chat.history.md +601 -0
- package/.aider.input.history +36 -0
- package/.aider.tags.cache.v3/{18/8b/7dfca822129dad10b5cacadf7728.val → 8e/ec/2d4659a1589a0187a757ab1cbefa.val} +0 -0
- package/.aider.tags.cache.v3/cache.db +0 -0
- package/.aider.tags.cache.v3/{8d/fa/12860238755bcfab9af8a93c52ab.val → d8/b0/a8966fcd65890fd9f70d7afe8141.val} +0 -0
- package/README.md +60 -347
- package/dist/common/src/CoreTypes.js +2 -0
- package/dist/common/src/PM/PM_WithEslintAndTsc.js +10 -8
- package/dist/common/src/PM/main.js +12 -7
- package/dist/common/src/PM/node.js +10 -3
- package/dist/common/src/build.js +3 -2
- package/dist/common/src/esbuildConfigs/eslint-formatter-testeranto.js +16 -1
- package/dist/common/src/esbuildConfigs/node.js +2 -16
- package/dist/common/src/esbuildConfigs/pure.js +2 -16
- package/dist/common/src/esbuildConfigs/rebuildPlugin.js +22 -0
- package/dist/common/src/esbuildConfigs/web.js +2 -16
- package/dist/common/src/lib/abstractBase.js +6 -1
- package/dist/common/src/lib/classBuilder.js +2 -3
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/src/CoreTypes.js +1 -0
- package/dist/module/src/PM/PM_WithEslintAndTsc.js +10 -8
- package/dist/module/src/PM/main.js +12 -7
- package/dist/module/src/PM/node.js +10 -3
- package/dist/module/src/build.js +3 -2
- package/dist/module/src/esbuildConfigs/eslint-formatter-testeranto.js +16 -1
- package/dist/module/src/esbuildConfigs/node.js +2 -16
- package/dist/module/src/esbuildConfigs/pure.js +2 -16
- package/dist/module/src/esbuildConfigs/rebuildPlugin.js +17 -0
- package/dist/module/src/esbuildConfigs/web.js +2 -16
- package/dist/module/src/lib/abstractBase.js +6 -1
- package/dist/module/src/lib/classBuilder.js +2 -3
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/Project.js +15 -16
- package/dist/prebuild/TestReport.js +12 -14
- package/dist/prebuild/build.mjs +39 -61
- package/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs +14 -1
- package/dist/prebuild/run.mjs +50 -31
- package/dist/types/src/CoreTypes.d.ts +51 -0
- package/dist/types/src/Node.d.ts +2 -2
- package/dist/types/src/PM/__tests__/nodeSidecar.testeranto.d.ts +1 -19
- package/dist/types/src/PM/__tests__/pureSidecar.testeranto.d.ts +1 -19
- package/dist/types/src/PM/__tests__/webSidecar.testeranto.d.ts +1 -19
- package/dist/types/src/PM/index.d.ts +1 -1
- package/dist/types/src/Types.d.ts +13 -57
- package/dist/types/src/Web.d.ts +1 -1
- package/dist/types/src/esbuildConfigs/rebuildPlugin.d.ts +6 -0
- package/dist/types/src/lib/abstractBase.d.ts +2 -8
- package/dist/types/src/lib/core.d.ts +1 -1
- package/dist/types/src/mothership/test.d.ts +1 -20
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/docs/index.md +277 -0
- package/package.json +6 -1
- package/src/CoreTypes.ts +171 -0
- package/src/Node.ts +25 -11
- package/src/PM/PM_WithEslintAndTsc.ts +46 -15
- package/src/PM/index.ts +1 -1
- package/src/PM/main.ts +17 -16
- package/src/PM/node.ts +10 -10
- package/src/Types.ts +166 -150
- package/src/Web.ts +0 -3
- package/src/build.ts +3 -2
- package/src/esbuildConfigs/eslint-formatter-testeranto.ts +17 -1
- package/src/esbuildConfigs/node.ts +2 -18
- package/src/esbuildConfigs/pure.ts +2 -18
- package/src/esbuildConfigs/rebuildPlugin.ts +23 -0
- package/src/esbuildConfigs/web.ts +2 -18
- package/src/lib/abstractBase.ts +6 -1
- package/src/lib/classBuilder.ts +5 -4
- package/src/lib/core.ts +5 -9
- package/.aider.tags.cache.v3/cache.db-shm +0 -0
- package/.aider.tags.cache.v3/cache.db-wal +0 -0
package/README.md
CHANGED
|
@@ -73,6 +73,66 @@ yarn t-build rectangle.test.ts dev
|
|
|
73
73
|
yarn t-run rectangle.test.ts dev
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
+
### Development Workflow
|
|
77
|
+
|
|
78
|
+
```mermaid
|
|
79
|
+
|
|
80
|
+
flowchart LR
|
|
81
|
+
|
|
82
|
+
subgraph hh["humans"]
|
|
83
|
+
direction LR
|
|
84
|
+
Human[🧑💻 ]
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
subgraph bb["AI"]
|
|
88
|
+
direction LR
|
|
89
|
+
Bot[🤖🧠 aider]
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
tests ---> L
|
|
94
|
+
subgraph tests
|
|
95
|
+
direction LR
|
|
96
|
+
A[Test Specification]
|
|
97
|
+
B[Test Interface]
|
|
98
|
+
C[Test Implementation]
|
|
99
|
+
K[application code]
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
subgraph buildSystem
|
|
103
|
+
direction TB
|
|
104
|
+
L["t-build"]
|
|
105
|
+
M[t-run]
|
|
106
|
+
L ---> M
|
|
107
|
+
|
|
108
|
+
M ---> N
|
|
109
|
+
M --->O
|
|
110
|
+
M --->P
|
|
111
|
+
N["BDD tests"]
|
|
112
|
+
O["Static analysis"]
|
|
113
|
+
P["Type checking"]
|
|
114
|
+
|
|
115
|
+
Q["reports"]
|
|
116
|
+
N ---> Q
|
|
117
|
+
O ---> Q
|
|
118
|
+
P ---> Q
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
Q ---> bb
|
|
122
|
+
|
|
123
|
+
buildSystem ---> bb
|
|
124
|
+
bb ---> tests
|
|
125
|
+
hh ---> tests
|
|
126
|
+
|
|
127
|
+
%% Styling
|
|
128
|
+
style Human fill:#268bd2,stroke:#586e75,color:#fdf6e3
|
|
129
|
+
style Bot fill:#d33682,stroke:#586e75,color:#fdf6e3
|
|
130
|
+
|
|
131
|
+
%% Layout tweaks
|
|
132
|
+
classDef column margin-right:20px
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
|
|
76
136
|
## Architecture Overview
|
|
77
137
|
|
|
78
138
|
```mermaid
|
|
@@ -207,353 +267,6 @@ test0: Given.Default(
|
|
|
207
267
|
|
|
208
268
|
```
|
|
209
269
|
|
|
210
|
-
## Core Concepts
|
|
211
|
-
|
|
212
|
-
Testeranto's type system provides a rigorous framework for Behavior-Driven Development (BDD) testing. Let's break down the key components using a Rectangle class example.
|
|
213
|
-
|
|
214
|
-
### 1. Test Subject
|
|
215
|
-
|
|
216
|
-
First, define the class you want to test:
|
|
217
|
-
|
|
218
|
-
```typescript
|
|
219
|
-
class Rectangle {
|
|
220
|
-
constructor(public width: number, public height: number) {}
|
|
221
|
-
|
|
222
|
-
setWidth(w: number) {
|
|
223
|
-
this.width = w;
|
|
224
|
-
}
|
|
225
|
-
setHeight(h: number) {
|
|
226
|
-
this.height = h;
|
|
227
|
-
}
|
|
228
|
-
getArea() {
|
|
229
|
-
return this.width * this.height;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
### 2. Test Interface Types
|
|
235
|
-
|
|
236
|
-
Testeranto uses a powerful type system to ensure your tests match your implementation:
|
|
237
|
-
|
|
238
|
-
```typescript
|
|
239
|
-
type IRectangle = Ibdd_in<
|
|
240
|
-
null, // No special initialization needed
|
|
241
|
-
null, // No special cleanup needed
|
|
242
|
-
Rectangle, // The test subject type
|
|
243
|
-
Rectangle, // State type between test steps
|
|
244
|
-
Rectangle, // Final state type
|
|
245
|
-
(n: number) => (r: Rectangle) => void, // When functions signature
|
|
246
|
-
(r: Rectangle) => number // Then functions signature
|
|
247
|
-
>;
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
This type definition ensures:
|
|
251
|
-
|
|
252
|
-
- Type safety throughout the test lifecycle
|
|
253
|
-
- Clear separation of test phases (setup, execution, verification)
|
|
254
|
-
- Proper function signatures for test steps
|
|
255
|
-
|
|
256
|
-
### 3. Test Specification
|
|
257
|
-
|
|
258
|
-
Define your BDD-style tests with full type checking:
|
|
259
|
-
|
|
260
|
-
```typescript
|
|
261
|
-
const RectangleSpec: ITestSpecification<IRectangle> = (
|
|
262
|
-
Suite,
|
|
263
|
-
Given,
|
|
264
|
-
When,
|
|
265
|
-
Then
|
|
266
|
-
) => [
|
|
267
|
-
Suite.Default("Rectangle Operations", {
|
|
268
|
-
// Test case 1: Basic dimension setting
|
|
269
|
-
basicDimensions: Given.Default(
|
|
270
|
-
["Validate basic rectangle operations"],
|
|
271
|
-
[When.setWidth(5), When.setHeight(10)], // Actions
|
|
272
|
-
[Then.getWidth(5), Then.getHeight(10)] // Assertions
|
|
273
|
-
),
|
|
274
|
-
|
|
275
|
-
// Test case 2: Area calculation
|
|
276
|
-
areaCalculation: Given.Default(
|
|
277
|
-
["Validate area calculation"],
|
|
278
|
-
[When.setWidth(3), When.setHeight(4)],
|
|
279
|
-
[(r) => r.getArea() === 12] // Custom assertion
|
|
280
|
-
),
|
|
281
|
-
}),
|
|
282
|
-
];
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
### Development Workflow
|
|
286
|
-
|
|
287
|
-
```mermaid
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
flowchart LR
|
|
293
|
-
|
|
294
|
-
subgraph hh["humans"]
|
|
295
|
-
direction LR
|
|
296
|
-
Human[🧑💻 ]
|
|
297
|
-
end
|
|
298
|
-
|
|
299
|
-
subgraph bb["AI"]
|
|
300
|
-
direction LR
|
|
301
|
-
Bot[🤖🧠 aider]
|
|
302
|
-
end
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
tests ---> L
|
|
306
|
-
subgraph tests
|
|
307
|
-
direction LR
|
|
308
|
-
A[Test Specification]
|
|
309
|
-
B[Test Interface]
|
|
310
|
-
C[Test Implementation]
|
|
311
|
-
K[application code]
|
|
312
|
-
end
|
|
313
|
-
|
|
314
|
-
subgraph buildSystem
|
|
315
|
-
direction TB
|
|
316
|
-
L["t-build"]
|
|
317
|
-
M[t-run]
|
|
318
|
-
L ---> M
|
|
319
|
-
|
|
320
|
-
M ---> N
|
|
321
|
-
M --->O
|
|
322
|
-
M --->P
|
|
323
|
-
N["BDD tests"]
|
|
324
|
-
O["Static analysis"]
|
|
325
|
-
P["Type checking"]
|
|
326
|
-
|
|
327
|
-
Q["reports"]
|
|
328
|
-
N ---> Q
|
|
329
|
-
O ---> Q
|
|
330
|
-
P ---> Q
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
end
|
|
335
|
-
|
|
336
|
-
Q ---> bb
|
|
337
|
-
|
|
338
|
-
buildSystem ---> bb
|
|
339
|
-
bb ---> tests
|
|
340
|
-
hh ---> tests
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
%% Styling
|
|
348
|
-
style Human fill:#268bd2,stroke:#586e75,color:#fdf6e3
|
|
349
|
-
style Bot fill:#d33682,stroke:#586e75,color:#fdf6e3
|
|
350
|
-
|
|
351
|
-
%% Layout tweaks
|
|
352
|
-
classDef column margin-right:20px
|
|
353
|
-
|
|
354
|
-
```
|
|
355
|
-
|
|
356
|
-
**Key Components:**
|
|
357
|
-
|
|
358
|
-
1. **Specification** - BDD test definitions (Given/When/Then)
|
|
359
|
-
2. **Implementation** - Concrete test logic and assertions
|
|
360
|
-
3. **Interface** - Test lifecycle hooks (before/after each)
|
|
361
|
-
|
|
362
|
-
**Rapid Development Loop:**
|
|
363
|
-
|
|
364
|
-
1. `t-build` continuously type-checks and bundles tests
|
|
365
|
-
2. `t-run` executes tests as they change
|
|
366
|
-
3. Aider analyzes failures and suggests fixes
|
|
367
|
-
4. Developer iterates based on feedback
|
|
368
|
-
|
|
369
|
-
The workflow creates a tight feedback loop where:
|
|
370
|
-
|
|
371
|
-
- Type errors are caught immediately during build
|
|
372
|
-
- Test failures trigger AI-assisted fixes
|
|
373
|
-
- Changes propagate instantly through the system
|
|
374
|
-
|
|
375
|
-
2. **Autocomplete** - IDE support for test steps
|
|
376
|
-
3. **Refactoring safety** - Changes to implementation trigger type errors in tests
|
|
377
|
-
4. **Documentation** - Types serve as living documentation
|
|
378
|
-
|
|
379
|
-
### The Testing Lifecycle
|
|
380
|
-
|
|
381
|
-
1. **Given** - Set up initial state
|
|
382
|
-
2. **When** - Perform actions on the subject
|
|
383
|
-
3. **Then** - Verify outcomes
|
|
384
|
-
4. **Check** - Imperative-style validations (optional)
|
|
385
|
-
|
|
386
|
-
Each phase is type-checked against your interface definition, ensuring tests remain valid as your code evolves.
|
|
387
|
-
|
|
388
|
-
```js
|
|
389
|
-
export default async <I extends IT, O extends OT, M>(
|
|
390
|
-
|
|
391
|
-
// the thing that is being tested.
|
|
392
|
-
input: I["iinput"],
|
|
393
|
-
|
|
394
|
-
testSpecification: ITestSpecification<I, O>,
|
|
395
|
-
testImplementation: ITestImplementation<I, O, M>,
|
|
396
|
-
testInterface: Partial<IWebTestInterface<I>>,
|
|
397
|
-
testResourceRequirement: ITTestResourceRequest = defaultTestResourceRequirement
|
|
398
|
-
) => {
|
|
399
|
-
|
|
400
|
-
// or WebTesteranto<I, O, M> or PureTesteranto<I, O, M>
|
|
401
|
-
return new NodeTesteranto<I, O, M>(
|
|
402
|
-
input,
|
|
403
|
-
testSpecification,
|
|
404
|
-
testImplementation,
|
|
405
|
-
testResourceRequirement,
|
|
406
|
-
testInterface
|
|
407
|
-
);
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
Practically speaking, for each thing you test, you will need to implement 3 types and 4 objects.
|
|
413
|
-
|
|
414
|
-
#### type I
|
|
415
|
-
|
|
416
|
-
this type describes the shape of the BDD test
|
|
417
|
-
|
|
418
|
-
```ts
|
|
419
|
-
export type I = Ibdd_in<
|
|
420
|
-
null,
|
|
421
|
-
null,
|
|
422
|
-
Rectangle,
|
|
423
|
-
Rectangle,
|
|
424
|
-
Rectangle,
|
|
425
|
-
(...x) => (rectangle: Rectangle, utils: IPM) => Rectangle,
|
|
426
|
-
(rectangle: Rectangle, utils: IPM) => Rectangle
|
|
427
|
-
>;
|
|
428
|
-
```
|
|
429
|
-
|
|
430
|
-
#### type O
|
|
431
|
-
|
|
432
|
-
this type describes the shape of the "interface"
|
|
433
|
-
|
|
434
|
-
```ts
|
|
435
|
-
export type O = Ibdd_out<
|
|
436
|
-
// Suite
|
|
437
|
-
{
|
|
438
|
-
Default: [string];
|
|
439
|
-
},
|
|
440
|
-
// "Given" are initial states
|
|
441
|
-
{
|
|
442
|
-
Default;
|
|
443
|
-
WidthOfOneAndHeightOfOne;
|
|
444
|
-
WidthAndHeightOf: [number, number];
|
|
445
|
-
},
|
|
446
|
-
// "Whens" are steps which change the state of the test subject
|
|
447
|
-
{
|
|
448
|
-
HeightIsPubliclySetTo: [number];
|
|
449
|
-
WidthIsPubliclySetTo: [number];
|
|
450
|
-
setWidth: [number];
|
|
451
|
-
setHeight: [number];
|
|
452
|
-
},
|
|
453
|
-
// "Thens" are steps which make assertions of the test subject
|
|
454
|
-
{
|
|
455
|
-
AreaPlusCircumference: [number];
|
|
456
|
-
circumference: [number];
|
|
457
|
-
getWidth: [number];
|
|
458
|
-
getHeight: [number];
|
|
459
|
-
area: [number];
|
|
460
|
-
prototype: [];
|
|
461
|
-
},
|
|
462
|
-
// "Checks" are similar to "Givens"
|
|
463
|
-
{
|
|
464
|
-
Default;
|
|
465
|
-
WidthOfOneAndHeightOfOne;
|
|
466
|
-
WidthAndHeightOf: [number, number];
|
|
467
|
-
}
|
|
468
|
-
>;
|
|
469
|
-
```
|
|
470
|
-
|
|
471
|
-
#### type M (optional)
|
|
472
|
-
|
|
473
|
-
this type describes the modifications to the shape of the "specification". It can be used to make your BDD tests DRYer but is not necessary
|
|
474
|
-
|
|
475
|
-
```ts
|
|
476
|
-
export type M = {
|
|
477
|
-
givens: {
|
|
478
|
-
[K in keyof O["givens"]]: (...Iw: O["givens"][K]) => Rectangle;
|
|
479
|
-
};
|
|
480
|
-
whens: {
|
|
481
|
-
[K in keyof O["whens"]]: (
|
|
482
|
-
...Iw: O["whens"][K]
|
|
483
|
-
) => (rectangle: Rectangle, utils: PM) => Rectangle;
|
|
484
|
-
};
|
|
485
|
-
thens: {
|
|
486
|
-
[K in keyof O["thens"]]: (
|
|
487
|
-
...Iw: O["thens"][K]
|
|
488
|
-
) => (rectangle: Rectangle, utils: PM) => Rectangle;
|
|
489
|
-
};
|
|
490
|
-
};
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
#### the "specification" aka ITestSpecification<I, O>
|
|
494
|
-
|
|
495
|
-
The test specification is the BDD tests logic. The specification implements BDD directives "Given", "When", and Then"
|
|
496
|
-
|
|
497
|
-
```ts
|
|
498
|
-
export const RectangleTesterantoBaseTestSpecification: ITestSpecification<
|
|
499
|
-
I,
|
|
500
|
-
O
|
|
501
|
-
> = (Suite, Given, When, Then, Check) => {
|
|
502
|
-
return [
|
|
503
|
-
Suite.Default(
|
|
504
|
-
"Testing the Rectangle class",
|
|
505
|
-
{
|
|
506
|
-
// A "given" is a strict BDD test. It starts with an initial state, then executes the "whens" which update the test subject, and then executes the "thens" as a assertions.
|
|
507
|
-
test0: Given.Default(
|
|
508
|
-
// a list of features
|
|
509
|
-
["https://api.github.com/repos/adamwong246/testeranto/issues/8"],
|
|
510
|
-
// a list of "whens"
|
|
511
|
-
[When.setWidth(4), When.setHeight(19)],
|
|
512
|
-
// a list of "thens"
|
|
513
|
-
[Then.getWidth(4), Then.getHeight(19)]
|
|
514
|
-
),
|
|
515
|
-
},
|
|
516
|
-
|
|
517
|
-
[
|
|
518
|
-
// a "check" is a less strict style of test. Instead of lists of whens and thens, you get a function callback.
|
|
519
|
-
Check.Default("imperative style?!", [], async (rectangle) => {
|
|
520
|
-
Then.getWidth(2).thenCB(rectangle);
|
|
521
|
-
Then.getHeight(2).thenCB(rectangle);
|
|
522
|
-
When.setHeight(22).whenCB(rectangle);
|
|
523
|
-
Then.getHeight(232).thenCB(rectangle);
|
|
524
|
-
}),
|
|
525
|
-
]
|
|
526
|
-
),
|
|
527
|
-
];
|
|
528
|
-
};
|
|
529
|
-
```
|
|
530
|
-
|
|
531
|
-
#### the "interface" aka testInterface: Partial<IWebTestInterface<I>>
|
|
532
|
-
|
|
533
|
-
The test interface is code which is NOT BDD steps. The interface implements "before all", "after all", "before each", and "after each", all of which are optional. f
|
|
534
|
-
|
|
535
|
-
```ts
|
|
536
|
-
export const RectangleTesterantoBaseInterface: IPartialInterface<I> = {
|
|
537
|
-
beforeEach: async (subject, i) => {
|
|
538
|
-
return i();
|
|
539
|
-
},
|
|
540
|
-
andWhen: async function (s, whenCB, tr, utils) {
|
|
541
|
-
return whenCB(s)(s, utils);
|
|
542
|
-
},
|
|
543
|
-
butThen: async (s, t, tr, pm) => {
|
|
544
|
-
return t(s, pm);
|
|
545
|
-
},
|
|
546
|
-
};
|
|
547
|
-
```
|
|
548
|
-
|
|
549
|
-
#### the "test resource requirement" aka ITTestResourceRequest (optional)
|
|
550
|
-
|
|
551
|
-
The test resource requirement describes things that the test needs to run, namely network ports. It is optional, but you should add this argument if your test needs to rely upon network ports
|
|
552
|
-
|
|
553
|
-
```ts
|
|
554
|
-
// TODO add example of test resource requirement
|
|
555
|
-
```
|
|
556
|
-
|
|
557
270
|
## Sidecars (COMING SOON)
|
|
558
271
|
|
|
559
272
|
Along side your test, you can include a number of "sidecars" which are other bundled javascript assets upon which your test depends. For example, suppose you have an app with a frontend and backend component. You could run a react test in the web and include the node http server as a sidecar.
|
|
@@ -72,8 +72,12 @@ class PM_WithEslintAndTsc extends base_js_1.PM_Base {
|
|
|
72
72
|
this.makePrompt = async (entryPoint, addableFiles, platform) => {
|
|
73
73
|
this.summary[entryPoint].prompt = "?";
|
|
74
74
|
const promptPath = (0, utils_1.promptPather)(entryPoint, platform, this.name);
|
|
75
|
-
const testPaths = path_1.default.join("testeranto", "reports", this.name,
|
|
75
|
+
const testPaths = path_1.default.join("testeranto", "reports", this.name, entryPoint.split(".").slice(0, -1).join("."), platform, `tests.json`);
|
|
76
76
|
const featuresPath = path_1.default.join("testeranto", "reports", this.name, platform, entryPoint.split(".").slice(0, -1).join("."), `featurePrompt.txt`);
|
|
77
|
+
const logPath = path_1.default.join("testeranto", "reports", this.name, entryPoint.split(".").slice(0, -1).join("."), platform, `console_log.txt`);
|
|
78
|
+
const lintPath = path_1.default.join("testeranto", "reports", this.name, entryPoint.split(".").slice(0, -1).join("."), platform, `lint_errors.json`);
|
|
79
|
+
const typePath = path_1.default.join("testeranto", "reports", this.name, entryPoint.split(".").slice(0, -1).join("."), platform, `type_errors.txt`);
|
|
80
|
+
const messagePath = path_1.default.join("testeranto", "reports", this.name, entryPoint.split(".").slice(0, -1).join("."), platform, `message`);
|
|
77
81
|
fs_1.default.writeFileSync(promptPath, `
|
|
78
82
|
${addableFiles
|
|
79
83
|
.map((x) => {
|
|
@@ -81,14 +85,12 @@ ${addableFiles
|
|
|
81
85
|
})
|
|
82
86
|
.join("\n")}
|
|
83
87
|
|
|
84
|
-
/read ${(0, utils_1.lintPather)(entryPoint, platform, this.name)}
|
|
85
|
-
/read ${(0, utils_1.tscPather)(entryPoint, platform, this.name)}
|
|
86
88
|
/read ${testPaths}
|
|
87
|
-
|
|
88
|
-
/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
/read ${logPath}
|
|
90
|
+
/read ${typePath}
|
|
91
|
+
/read ${lintPath}
|
|
92
|
+
`);
|
|
93
|
+
fs_1.default.writeFileSync(messagePath, `Fix the failing tests described in ${testPaths} and ${logPath}. DO NOT refactor beyond what is necessary. Always prefer minimal changes, focusing mostly on keeping the BDD tests passing`);
|
|
92
94
|
this.summary[entryPoint].prompt = `aider --model deepseek/deepseek-chat --load testeranto/${this.name}/reports/${platform}/${entryPoint
|
|
93
95
|
.split(".")
|
|
94
96
|
.slice(0, -1)
|
|
@@ -312,7 +312,9 @@ class PM_Main extends PM_WithEslintAndTsc_js_1.PM_WithEslintAndTsc {
|
|
|
312
312
|
const builtfile = dest;
|
|
313
313
|
let haltReturns = false;
|
|
314
314
|
const ipcfile = "/tmp/tpipe_" + Math.random();
|
|
315
|
-
const child = (0, node_child_process_1.spawn)("node",
|
|
315
|
+
const child = (0, node_child_process_1.spawn)("node",
|
|
316
|
+
// "node --inspect-brk ",
|
|
317
|
+
[builtfile, testResources, ipcfile], {
|
|
316
318
|
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
|
317
319
|
});
|
|
318
320
|
let buffer = new Buffer("");
|
|
@@ -367,7 +369,6 @@ class PM_Main extends PM_WithEslintAndTsc_js_1.PM_WithEslintAndTsc {
|
|
|
367
369
|
oStream.write(`stdout > ${data}`);
|
|
368
370
|
});
|
|
369
371
|
child.on("close", (code) => {
|
|
370
|
-
console.log("close");
|
|
371
372
|
oStream.close();
|
|
372
373
|
server.close();
|
|
373
374
|
// this.receiveFeaturesV2(reportDest, src, "node");
|
|
@@ -386,14 +387,12 @@ class PM_Main extends PM_WithEslintAndTsc_js_1.PM_WithEslintAndTsc {
|
|
|
386
387
|
haltReturns = true;
|
|
387
388
|
});
|
|
388
389
|
child.on("exit", (code) => {
|
|
389
|
-
console.log("exit");
|
|
390
390
|
haltReturns = true;
|
|
391
391
|
for (let i = 0; i <= portsToUse.length; i++) {
|
|
392
392
|
if (portsToUse[i]) {
|
|
393
393
|
this.ports[portsToUse[i]] = true; //port is open again
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
|
-
console.log("exitthis.ports", this.ports);
|
|
397
396
|
});
|
|
398
397
|
child.on("error", (e) => {
|
|
399
398
|
console.log("error");
|
|
@@ -429,7 +428,10 @@ class PM_Main extends PM_WithEslintAndTsc_js_1.PM_WithEslintAndTsc {
|
|
|
429
428
|
files[src] = new Set();
|
|
430
429
|
}
|
|
431
430
|
// files[t].add(filepath);
|
|
432
|
-
|
|
431
|
+
// fs.writeFileSync(
|
|
432
|
+
// destFolder + "/manifest.json",
|
|
433
|
+
// JSON.stringify(Array.from(files[src]))
|
|
434
|
+
// );
|
|
433
435
|
delete files[src];
|
|
434
436
|
Promise.all(screenshots[src] || []).then(() => {
|
|
435
437
|
delete screenshots[src];
|
|
@@ -749,7 +751,10 @@ class PM_Main extends PM_WithEslintAndTsc_js_1.PM_WithEslintAndTsc {
|
|
|
749
751
|
files[src] = new Set();
|
|
750
752
|
}
|
|
751
753
|
// files[t].add(filepath);
|
|
752
|
-
|
|
754
|
+
// fs.writeFileSync(
|
|
755
|
+
// destFolder + "/manifest.json",
|
|
756
|
+
// JSON.stringify(Array.from(files[src]))
|
|
757
|
+
// );
|
|
753
758
|
delete files[src];
|
|
754
759
|
Promise.all(screenshots[src] || []).then(() => {
|
|
755
760
|
delete screenshots[src];
|
|
@@ -970,7 +975,7 @@ class PM_Main extends PM_WithEslintAndTsc_js_1.PM_WithEslintAndTsc {
|
|
|
970
975
|
slowMo: 1,
|
|
971
976
|
waitForInitialPage: false,
|
|
972
977
|
executablePath,
|
|
973
|
-
headless:
|
|
978
|
+
headless: true,
|
|
974
979
|
dumpio: false,
|
|
975
980
|
devtools: false,
|
|
976
981
|
args: [
|
|
@@ -150,9 +150,16 @@ class PM_Node extends _1.PM {
|
|
|
150
150
|
if (error) {
|
|
151
151
|
console.error(`❗️testArtiFactory failed`, targetDir, error);
|
|
152
152
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
// fs.writeFileSync(
|
|
154
|
+
// path.resolve(
|
|
155
|
+
// targetDir.split("/").slice(0, -1).join("/"),
|
|
156
|
+
// "manifest"
|
|
157
|
+
// ),
|
|
158
|
+
// fPaths.join(`\n`),
|
|
159
|
+
// {
|
|
160
|
+
// encoding: "utf-8",
|
|
161
|
+
// }
|
|
162
|
+
// );
|
|
156
163
|
if (Buffer.isBuffer(value)) {
|
|
157
164
|
fs_1.default.writeFileSync(fPath, value, "binary");
|
|
158
165
|
res();
|
package/dist/common/src/build.js
CHANGED
|
@@ -179,13 +179,14 @@ Promise.resolve(`${process.cwd() + "/" + "testeranto.config.ts"}`).then(s => __i
|
|
|
179
179
|
<title>${pckge.name} - testeranto</title>
|
|
180
180
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
181
181
|
<meta name="author" content="" />
|
|
182
|
+
<base href="https://adamwong246.github.io/spacetrash_v8" target="_blank">
|
|
182
183
|
|
|
183
184
|
<script type="application/json" id="bigConfig">
|
|
184
185
|
${JSON.stringify(Object.keys(bigConfig.projects))}
|
|
185
186
|
</script>
|
|
186
187
|
|
|
187
|
-
<link rel="stylesheet" href="Project.css" />
|
|
188
|
-
<script type="module" src="Project.js"></script>
|
|
188
|
+
<link rel="stylesheet" href="/reports/Project.css" />
|
|
189
|
+
<script type="module" src="/reports/Project.js"></script>
|
|
189
190
|
|
|
190
191
|
</head>
|
|
191
192
|
|
|
@@ -2,5 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = default_1;
|
|
4
4
|
function default_1(results) {
|
|
5
|
-
return
|
|
5
|
+
return results
|
|
6
|
+
.filter((r) => r.messages.length)
|
|
7
|
+
.map((r) => {
|
|
8
|
+
const path = r.filePath.replace(process.cwd() + "/", "");
|
|
9
|
+
return [
|
|
10
|
+
path,
|
|
11
|
+
...r.messages.map((m) => {
|
|
12
|
+
var _a;
|
|
13
|
+
return [
|
|
14
|
+
`${m.line}:${m.column} ${m.message} (${m.ruleId || ""})`,
|
|
15
|
+
...(((_a = m.suggestions) === null || _a === void 0 ? void 0 : _a.map((s) => `- ${s.message}${s.fix ? " (fix)" : ""}`)) || []),
|
|
16
|
+
].join("\n");
|
|
17
|
+
}),
|
|
18
|
+
].join("\n");
|
|
19
|
+
})
|
|
20
|
+
.join("\n\n");
|
|
6
21
|
}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const index_js_1 = __importDefault(require("./index.js"));
|
|
7
7
|
const inputFilesPlugin_js_1 = __importDefault(require("./inputFilesPlugin.js"));
|
|
8
8
|
const featuresPlugin_1 = __importDefault(require("./featuresPlugin"));
|
|
9
|
+
const rebuildPlugin_js_1 = __importDefault(require("./rebuildPlugin.js"));
|
|
9
10
|
exports.default = (config, entryPoints, testName) => {
|
|
10
11
|
const { inputFilesPluginFactory, register } = (0, inputFilesPlugin_js_1.default)("node", testName);
|
|
11
12
|
return Object.assign(Object.assign({}, (0, index_js_1.default)(config)), { splitting: true, outdir: `testeranto/bundles/node/${testName}/`,
|
|
@@ -19,22 +20,7 @@ exports.default = (config, entryPoints, testName) => {
|
|
|
19
20
|
}, platform: "node", external: ["react", ...config.externals], entryPoints: [...entryPoints], plugins: [
|
|
20
21
|
featuresPlugin_1.default,
|
|
21
22
|
inputFilesPluginFactory,
|
|
22
|
-
|
|
23
|
-
name: "rebuild-notify",
|
|
24
|
-
setup: (build) => {
|
|
25
|
-
build.onStart(() => {
|
|
26
|
-
console.log(`> node build starting...`);
|
|
27
|
-
});
|
|
28
|
-
build.onEnd((result) => {
|
|
29
|
-
console.log(`> node build ended with ${result.errors.length} errors`);
|
|
30
|
-
if (result.errors.length > 0) {
|
|
31
|
-
console.log(result);
|
|
32
|
-
}
|
|
33
|
-
// console.log(result);
|
|
34
|
-
// result.errors.length !== 0 && process.exit(-1);
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
},
|
|
23
|
+
(0, rebuildPlugin_js_1.default)("node"),
|
|
38
24
|
...(config.nodePlugins.map((p) => p(register, entryPoints)) || []),
|
|
39
25
|
] });
|
|
40
26
|
};
|
|
@@ -8,6 +8,7 @@ const inputFilesPlugin_js_1 = __importDefault(require("./inputFilesPlugin.js"));
|
|
|
8
8
|
const featuresPlugin_js_1 = __importDefault(require("./featuresPlugin.js"));
|
|
9
9
|
const node_module_1 = require("node:module");
|
|
10
10
|
const consoleDetectorPlugin_js_1 = require("./consoleDetectorPlugin.js");
|
|
11
|
+
const rebuildPlugin_js_1 = __importDefault(require("./rebuildPlugin.js"));
|
|
11
12
|
exports.default = (config, entryPoints, testName) => {
|
|
12
13
|
const { inputFilesPluginFactory, register } = (0, inputFilesPlugin_js_1.default)("pure", testName);
|
|
13
14
|
return Object.assign(Object.assign({}, (0, index_js_1.default)(config)), { drop: [], splitting: true, outdir: `testeranto/bundles/pure/${testName}/`,
|
|
@@ -33,22 +34,7 @@ exports.default = (config, entryPoints, testName) => {
|
|
|
33
34
|
});
|
|
34
35
|
},
|
|
35
36
|
},
|
|
36
|
-
|
|
37
|
-
name: "rebuild-notify",
|
|
38
|
-
setup: (build) => {
|
|
39
|
-
build.onStart(() => {
|
|
40
|
-
console.log(`> pure build starting...`);
|
|
41
|
-
});
|
|
42
|
-
build.onEnd((result) => {
|
|
43
|
-
console.log(`> pure build ended with ${result.errors.length} errors`);
|
|
44
|
-
if (result.errors.length > 0) {
|
|
45
|
-
console.log(result);
|
|
46
|
-
}
|
|
47
|
-
// console.log(result);
|
|
48
|
-
// result.errors.length !== 0 && process.exit(-1);
|
|
49
|
-
});
|
|
50
|
-
},
|
|
51
|
-
},
|
|
37
|
+
(0, rebuildPlugin_js_1.default)("pure"),
|
|
52
38
|
...((config.nodePlugins || []).map((p) => p(register, entryPoints)) ||
|
|
53
39
|
[]),
|
|
54
40
|
] });
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
|
+
exports.default = (r) => {
|
|
8
|
+
return {
|
|
9
|
+
name: "rebuild-notify",
|
|
10
|
+
setup: (build) => {
|
|
11
|
+
build.onStart(() => {
|
|
12
|
+
console.log(`> web build starting...`);
|
|
13
|
+
});
|
|
14
|
+
build.onEnd((result) => {
|
|
15
|
+
console.log(`> web build ended with ${result.errors.length} errors`);
|
|
16
|
+
if (result.errors.length > 0) {
|
|
17
|
+
fs_1.default.writeFileSync(`./testeranto/reports${r}_build_errors`, JSON.stringify(result, null, 2));
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
};
|