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/src/PM/node.ts
CHANGED
|
@@ -241,16 +241,16 @@ export class PM_Node extends PM {
|
|
|
241
241
|
console.error(`❗️testArtiFactory failed`, targetDir, error);
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
fs.writeFileSync(
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
);
|
|
244
|
+
// fs.writeFileSync(
|
|
245
|
+
// path.resolve(
|
|
246
|
+
// targetDir.split("/").slice(0, -1).join("/"),
|
|
247
|
+
// "manifest"
|
|
248
|
+
// ),
|
|
249
|
+
// fPaths.join(`\n`),
|
|
250
|
+
// {
|
|
251
|
+
// encoding: "utf-8",
|
|
252
|
+
// }
|
|
253
|
+
// );
|
|
254
254
|
|
|
255
255
|
if (Buffer.isBuffer(value)) {
|
|
256
256
|
fs.writeFileSync(fPath, value, "binary");
|
package/src/Types.ts
CHANGED
|
@@ -2,16 +2,42 @@
|
|
|
2
2
|
import { Plugin } from "esbuild";
|
|
3
3
|
import { ITTestResourceConfiguration } from "./lib/index.js";
|
|
4
4
|
import { PM } from "./PM/index.js";
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
import {
|
|
7
|
-
IGivens,
|
|
8
|
-
BaseCheck,
|
|
9
|
-
BaseSuite,
|
|
10
7
|
BaseWhen,
|
|
11
8
|
BaseThen,
|
|
12
9
|
BaseGiven,
|
|
10
|
+
BaseCheck,
|
|
11
|
+
BaseSuite,
|
|
12
|
+
IGivens,
|
|
13
13
|
} from "./lib/abstractBase.js";
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
import { Ibdd_in, Ibdd_out } from "./CoreTypes.js";
|
|
16
|
+
|
|
17
|
+
export type SuiteSpecification<
|
|
18
|
+
I extends Ibdd_in<
|
|
19
|
+
unknown,
|
|
20
|
+
unknown,
|
|
21
|
+
unknown,
|
|
22
|
+
unknown,
|
|
23
|
+
unknown,
|
|
24
|
+
unknown,
|
|
25
|
+
unknown
|
|
26
|
+
>,
|
|
27
|
+
O extends Ibdd_out<
|
|
28
|
+
TestSuiteShape,
|
|
29
|
+
TestGivenShape,
|
|
30
|
+
TestWhenShape,
|
|
31
|
+
TestThenShape,
|
|
32
|
+
TestCheckShape
|
|
33
|
+
>
|
|
34
|
+
> = {
|
|
35
|
+
[K in keyof O["suites"]]: (
|
|
36
|
+
name: string,
|
|
37
|
+
givens: IGivens<I>,
|
|
38
|
+
checks: BaseCheck<I>[]
|
|
39
|
+
) => BaseSuite<I, O>;
|
|
40
|
+
};
|
|
15
41
|
|
|
16
42
|
// Simplified test result summary
|
|
17
43
|
export type TestSummary = {
|
|
@@ -82,16 +108,24 @@ export type ProjectConfig = {
|
|
|
82
108
|
debug?: boolean;
|
|
83
109
|
};
|
|
84
110
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
111
|
+
export type GivenSpecification<
|
|
112
|
+
I extends Ibdd_in<
|
|
113
|
+
unknown,
|
|
114
|
+
unknown,
|
|
115
|
+
unknown,
|
|
116
|
+
unknown,
|
|
117
|
+
unknown,
|
|
118
|
+
unknown,
|
|
119
|
+
unknown
|
|
120
|
+
>,
|
|
121
|
+
O extends Ibdd_out<
|
|
122
|
+
TestSuiteShape,
|
|
123
|
+
TestGivenShape,
|
|
124
|
+
TestWhenShape,
|
|
125
|
+
TestThenShape,
|
|
126
|
+
TestCheckShape
|
|
127
|
+
>
|
|
128
|
+
> = {
|
|
95
129
|
[K in keyof O["givens"]]: (
|
|
96
130
|
features: string[],
|
|
97
131
|
whens: BaseWhen<I>[],
|
|
@@ -100,35 +134,102 @@ export type GivenSpecification<I extends IT, O extends OT> = {
|
|
|
100
134
|
) => BaseGiven<I>;
|
|
101
135
|
};
|
|
102
136
|
|
|
103
|
-
export type WhenSpecification<
|
|
137
|
+
export type WhenSpecification<
|
|
138
|
+
I extends Ibdd_in<
|
|
139
|
+
unknown,
|
|
140
|
+
unknown,
|
|
141
|
+
unknown,
|
|
142
|
+
unknown,
|
|
143
|
+
unknown,
|
|
144
|
+
unknown,
|
|
145
|
+
unknown
|
|
146
|
+
>,
|
|
147
|
+
O extends Ibdd_out<
|
|
148
|
+
TestSuiteShape,
|
|
149
|
+
TestGivenShape,
|
|
150
|
+
TestWhenShape,
|
|
151
|
+
TestThenShape,
|
|
152
|
+
TestCheckShape
|
|
153
|
+
>
|
|
154
|
+
> = {
|
|
104
155
|
[K in keyof O["whens"]]: (...xtrasC: O["whens"][K]) => BaseWhen<I>;
|
|
105
156
|
};
|
|
106
157
|
|
|
107
|
-
export type ThenSpecification<
|
|
158
|
+
export type ThenSpecification<
|
|
159
|
+
I extends Ibdd_in<
|
|
160
|
+
unknown,
|
|
161
|
+
unknown,
|
|
162
|
+
unknown,
|
|
163
|
+
unknown,
|
|
164
|
+
unknown,
|
|
165
|
+
unknown,
|
|
166
|
+
unknown
|
|
167
|
+
>,
|
|
168
|
+
O extends Ibdd_out<
|
|
169
|
+
TestSuiteShape,
|
|
170
|
+
TestGivenShape,
|
|
171
|
+
TestWhenShape,
|
|
172
|
+
TestThenShape,
|
|
173
|
+
TestCheckShape
|
|
174
|
+
>
|
|
175
|
+
> = {
|
|
108
176
|
[K in keyof O["thens"]]: (...xtrasD: O["thens"][K]) => BaseThen<I>;
|
|
109
177
|
};
|
|
110
178
|
|
|
111
|
-
// Complete test specification
|
|
112
|
-
export type ITestSpecification<I extends IT, O extends OT> = (
|
|
113
|
-
Suite: SuiteSpecification<I, O>,
|
|
114
|
-
Given: GivenSpecification<I, O>,
|
|
115
|
-
When: WhenSpecification<I, O>,
|
|
116
|
-
Then: ThenSpecification<I, O>,
|
|
117
|
-
Check: ITestCheckCallback<I, O>
|
|
118
|
-
) => any[];
|
|
119
|
-
|
|
120
179
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
121
180
|
|
|
122
181
|
// Base implementation types
|
|
123
|
-
export type TestSuiteImplementation<
|
|
182
|
+
export type TestSuiteImplementation<
|
|
183
|
+
O extends Ibdd_out<
|
|
184
|
+
TestSuiteShape,
|
|
185
|
+
TestGivenShape,
|
|
186
|
+
TestWhenShape,
|
|
187
|
+
TestThenShape,
|
|
188
|
+
TestCheckShape
|
|
189
|
+
>
|
|
190
|
+
> = {
|
|
124
191
|
[K in keyof O["suites"]]: string;
|
|
125
192
|
};
|
|
126
193
|
|
|
127
|
-
export type TestGivenImplementation<
|
|
194
|
+
export type TestGivenImplementation<
|
|
195
|
+
I extends Ibdd_in<
|
|
196
|
+
unknown,
|
|
197
|
+
unknown,
|
|
198
|
+
unknown,
|
|
199
|
+
unknown,
|
|
200
|
+
unknown,
|
|
201
|
+
unknown,
|
|
202
|
+
unknown
|
|
203
|
+
>,
|
|
204
|
+
O extends Ibdd_out<
|
|
205
|
+
TestSuiteShape,
|
|
206
|
+
TestGivenShape,
|
|
207
|
+
TestWhenShape,
|
|
208
|
+
TestThenShape,
|
|
209
|
+
TestCheckShape
|
|
210
|
+
>
|
|
211
|
+
> = {
|
|
128
212
|
[K in keyof O["givens"]]: (...Ig: O["givens"][K]) => I["given"];
|
|
129
213
|
};
|
|
130
214
|
|
|
131
|
-
export type TestWhenImplementation<
|
|
215
|
+
export type TestWhenImplementation<
|
|
216
|
+
I extends Ibdd_in<
|
|
217
|
+
unknown,
|
|
218
|
+
unknown,
|
|
219
|
+
unknown,
|
|
220
|
+
unknown,
|
|
221
|
+
unknown,
|
|
222
|
+
unknown,
|
|
223
|
+
unknown
|
|
224
|
+
>,
|
|
225
|
+
O extends Ibdd_out<
|
|
226
|
+
TestSuiteShape,
|
|
227
|
+
TestGivenShape,
|
|
228
|
+
TestWhenShape,
|
|
229
|
+
TestThenShape,
|
|
230
|
+
TestCheckShape
|
|
231
|
+
>
|
|
232
|
+
> = {
|
|
132
233
|
[K in keyof O["whens"]]: (
|
|
133
234
|
...Iw: O["whens"][K]
|
|
134
235
|
) => (
|
|
@@ -138,72 +239,50 @@ export type TestWhenImplementation<I extends IT, O extends OT> = {
|
|
|
138
239
|
) => Promise<I["when"]>;
|
|
139
240
|
};
|
|
140
241
|
|
|
141
|
-
export type TestThenImplementation<
|
|
242
|
+
export type TestThenImplementation<
|
|
243
|
+
I extends Ibdd_in<
|
|
244
|
+
unknown,
|
|
245
|
+
unknown,
|
|
246
|
+
unknown,
|
|
247
|
+
unknown,
|
|
248
|
+
unknown,
|
|
249
|
+
unknown,
|
|
250
|
+
unknown
|
|
251
|
+
>,
|
|
252
|
+
O extends Ibdd_out<
|
|
253
|
+
TestSuiteShape,
|
|
254
|
+
TestGivenShape,
|
|
255
|
+
TestWhenShape,
|
|
256
|
+
TestThenShape,
|
|
257
|
+
TestCheckShape
|
|
258
|
+
>
|
|
259
|
+
> = {
|
|
142
260
|
[K in keyof O["thens"]]: (
|
|
143
261
|
...It: O["thens"][K]
|
|
144
262
|
) => (ssel: I["iselection"], utils: PM) => I["then"];
|
|
145
263
|
};
|
|
146
264
|
|
|
147
|
-
export type TestCheckImplementation<
|
|
265
|
+
export type TestCheckImplementation<
|
|
266
|
+
I extends Ibdd_in<
|
|
267
|
+
unknown,
|
|
268
|
+
unknown,
|
|
269
|
+
unknown,
|
|
270
|
+
unknown,
|
|
271
|
+
unknown,
|
|
272
|
+
unknown,
|
|
273
|
+
unknown
|
|
274
|
+
>,
|
|
275
|
+
O extends Ibdd_out<
|
|
276
|
+
TestSuiteShape,
|
|
277
|
+
TestGivenShape,
|
|
278
|
+
TestWhenShape,
|
|
279
|
+
TestThenShape,
|
|
280
|
+
TestCheckShape
|
|
281
|
+
>
|
|
282
|
+
> = {
|
|
148
283
|
[K in keyof O["checks"]]: (...Ic: O["checks"][K]) => I["given"];
|
|
149
284
|
};
|
|
150
285
|
|
|
151
|
-
// Complete test implementation
|
|
152
|
-
export type ITestImplementation<
|
|
153
|
-
I extends IT,
|
|
154
|
-
O extends OT,
|
|
155
|
-
modifier = {
|
|
156
|
-
whens: TestWhenImplementation<I, O>;
|
|
157
|
-
}
|
|
158
|
-
> = Modify<
|
|
159
|
-
{
|
|
160
|
-
suites: TestSuiteImplementation<O>;
|
|
161
|
-
givens: TestGivenImplementation<I, O>;
|
|
162
|
-
whens: TestWhenImplementation<I, O>;
|
|
163
|
-
thens: TestThenImplementation<I, O>;
|
|
164
|
-
checks: TestCheckImplementation<I, O>;
|
|
165
|
-
},
|
|
166
|
-
modifier
|
|
167
|
-
>;
|
|
168
|
-
|
|
169
|
-
// export type ITestImplementation<
|
|
170
|
-
// I extends IT,
|
|
171
|
-
// O extends OT,
|
|
172
|
-
// modifier = Partial<{
|
|
173
|
-
// // givens: string;
|
|
174
|
-
// givens: {
|
|
175
|
-
// [K in keyof O["givens"]]: (...Ig: O["givens"][K]) => I["given"];
|
|
176
|
-
// };
|
|
177
|
-
// }>
|
|
178
|
-
// > = Modify<
|
|
179
|
-
// {
|
|
180
|
-
// // suites: {
|
|
181
|
-
// // // [K in keyof O["suites"]]: unknown;
|
|
182
|
-
// // [K in keyof O["suites"]]: (...Ig: O["suites"][K]) => I["suites"];
|
|
183
|
-
// // };
|
|
184
|
-
// // suites: [];
|
|
185
|
-
|
|
186
|
-
// // givens: {
|
|
187
|
-
// // [K in keyof O["givens"]]: (...Ig: O["givens"][K]) => I["given"];
|
|
188
|
-
// // };
|
|
189
|
-
|
|
190
|
-
// whens: {
|
|
191
|
-
// [K in keyof O["whens"]]: (
|
|
192
|
-
// ...Iw: O["whens"][K]
|
|
193
|
-
// ) => (zel: I["iselection"], utils: PM) => Promise<I["when"]>;
|
|
194
|
-
// };
|
|
195
|
-
// thens: {
|
|
196
|
-
// [K in keyof O["thens"]]: (
|
|
197
|
-
// ...It: O["thens"][K]
|
|
198
|
-
// ) => (ssel: I["iselection"], utils: PM) => I["then"];
|
|
199
|
-
// };
|
|
200
|
-
// checks: {
|
|
201
|
-
// [K in keyof O["checks"]]: (...Ic: O["checks"][K]) => I["given"];
|
|
202
|
-
// };
|
|
203
|
-
// },
|
|
204
|
-
// modifier
|
|
205
|
-
// >;
|
|
206
|
-
|
|
207
286
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
208
287
|
|
|
209
288
|
export type Modify<T, R> = Omit<T, keyof R> & R;
|
|
@@ -215,69 +294,6 @@ export type TestWhenShape = Record<string, any>;
|
|
|
215
294
|
export type TestThenShape = Record<string, any>;
|
|
216
295
|
export type TestCheckShape = Record<string, any>;
|
|
217
296
|
|
|
218
|
-
// Complete BDD output shape
|
|
219
|
-
export type Ibdd_out<
|
|
220
|
-
ISuites extends TestSuiteShape = TestSuiteShape,
|
|
221
|
-
IGivens extends TestGivenShape = TestGivenShape,
|
|
222
|
-
IWhens extends TestWhenShape = TestWhenShape,
|
|
223
|
-
IThens extends TestThenShape = TestThenShape,
|
|
224
|
-
IChecks extends TestCheckShape = TestCheckShape
|
|
225
|
-
> = {
|
|
226
|
-
suites: ISuites;
|
|
227
|
-
givens: IGivens;
|
|
228
|
-
whens: IWhens;
|
|
229
|
-
thens: IThens;
|
|
230
|
-
checks: IChecks;
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Defines the input shape for BDD test definitions.
|
|
235
|
-
* This is the core type that structures all test operations.
|
|
236
|
-
*/
|
|
237
|
-
export type Ibdd_in<
|
|
238
|
-
IInput, // Type of initial test input
|
|
239
|
-
ISubject, // Type of object being tested
|
|
240
|
-
IStore, // Type for storing test state between steps
|
|
241
|
-
ISelection, // Type for selecting state for assertions
|
|
242
|
-
IGiven, // Type for Given step functions
|
|
243
|
-
IWhen, // Type for When step functions
|
|
244
|
-
IThen // Type for Then step functions
|
|
245
|
-
> = {
|
|
246
|
-
/** Initial input required to start tests */
|
|
247
|
-
iinput: IInput;
|
|
248
|
-
|
|
249
|
-
/** The subject being tested (class, function, etc) */
|
|
250
|
-
isubject: ISubject;
|
|
251
|
-
|
|
252
|
-
/** Complete test state storage */
|
|
253
|
-
istore: IStore;
|
|
254
|
-
|
|
255
|
-
/** Selected portion of state for assertions */
|
|
256
|
-
iselection: ISelection;
|
|
257
|
-
|
|
258
|
-
/** Function type for Given steps */
|
|
259
|
-
given: IGiven;
|
|
260
|
-
|
|
261
|
-
/** Function type for When steps */
|
|
262
|
-
when: IWhen;
|
|
263
|
-
|
|
264
|
-
/** Function type for Then steps */
|
|
265
|
-
then: IThen;
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
// Example usage:
|
|
269
|
-
/*
|
|
270
|
-
type CounterTest = Ibdd_in<
|
|
271
|
-
number, // Initial count value
|
|
272
|
-
Counter, // Test subject is Counter class
|
|
273
|
-
{ counter: Counter, env: any }, // Store counter + environment
|
|
274
|
-
number, // Assert against current count
|
|
275
|
-
(init: number) => Counter, // Given creates Counter
|
|
276
|
-
(delta: number) => (c: Counter) => void, // When modifies Counter
|
|
277
|
-
(expected: number) => (c: Counter) => void // Then asserts count
|
|
278
|
-
>;
|
|
279
|
-
*/
|
|
280
|
-
|
|
281
297
|
///////////////////////////////////////////////
|
|
282
298
|
|
|
283
299
|
export type IPluginFactory = (
|
package/src/Web.ts
CHANGED
package/src/build.ts
CHANGED
|
@@ -195,13 +195,14 @@ import(process.cwd() + "/" + "testeranto.config.ts").then(async (module) => {
|
|
|
195
195
|
<title>${pckge.name} - testeranto</title>
|
|
196
196
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
197
197
|
<meta name="author" content="" />
|
|
198
|
+
<base href="https://adamwong246.github.io/spacetrash_v8" target="_blank">
|
|
198
199
|
|
|
199
200
|
<script type="application/json" id="bigConfig">
|
|
200
201
|
${JSON.stringify(Object.keys(bigConfig.projects))}
|
|
201
202
|
</script>
|
|
202
203
|
|
|
203
|
-
<link rel="stylesheet" href="Project.css" />
|
|
204
|
-
<script type="module" src="Project.js"></script>
|
|
204
|
+
<link rel="stylesheet" href="/reports/Project.css" />
|
|
205
|
+
<script type="module" src="/reports/Project.js"></script>
|
|
205
206
|
|
|
206
207
|
</head>
|
|
207
208
|
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import { LintResult } from "eslint/lib/linter";
|
|
2
2
|
|
|
3
3
|
export default function (results: LintResult[]) {
|
|
4
|
-
return
|
|
4
|
+
return results
|
|
5
|
+
.filter((r) => r.messages.length)
|
|
6
|
+
.map((r) => {
|
|
7
|
+
const path = r.filePath.replace(process.cwd() + "/", "");
|
|
8
|
+
return [
|
|
9
|
+
path,
|
|
10
|
+
...r.messages.map((m) =>
|
|
11
|
+
[
|
|
12
|
+
`${m.line}:${m.column} ${m.message} (${m.ruleId || ""})`,
|
|
13
|
+
...(m.suggestions?.map(
|
|
14
|
+
(s) => `- ${s.message}${s.fix ? " (fix)" : ""}`
|
|
15
|
+
) || []),
|
|
16
|
+
].join("\n")
|
|
17
|
+
),
|
|
18
|
+
].join("\n");
|
|
19
|
+
})
|
|
20
|
+
.join("\n\n");
|
|
5
21
|
}
|
|
@@ -5,6 +5,7 @@ import { ITestconfig } from "../lib/index.js";
|
|
|
5
5
|
import baseEsBuildConfig from "./index.js";
|
|
6
6
|
import inputFilesPlugin from "./inputFilesPlugin.js";
|
|
7
7
|
import featuresPlugin from "./featuresPlugin";
|
|
8
|
+
import rebuildPlugin from "./rebuildPlugin.js";
|
|
8
9
|
|
|
9
10
|
export default (
|
|
10
11
|
config: ITestconfig,
|
|
@@ -44,24 +45,7 @@ export default (
|
|
|
44
45
|
featuresPlugin,
|
|
45
46
|
|
|
46
47
|
inputFilesPluginFactory,
|
|
47
|
-
|
|
48
|
-
name: "rebuild-notify",
|
|
49
|
-
setup: (build) => {
|
|
50
|
-
build.onStart(() => {
|
|
51
|
-
console.log(`> node build starting...`);
|
|
52
|
-
});
|
|
53
|
-
build.onEnd((result) => {
|
|
54
|
-
console.log(
|
|
55
|
-
`> node build ended with ${result.errors.length} errors`
|
|
56
|
-
);
|
|
57
|
-
if (result.errors.length > 0) {
|
|
58
|
-
console.log(result);
|
|
59
|
-
}
|
|
60
|
-
// console.log(result);
|
|
61
|
-
// result.errors.length !== 0 && process.exit(-1);
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
},
|
|
48
|
+
rebuildPlugin("node"),
|
|
65
49
|
|
|
66
50
|
...(config.nodePlugins.map((p) => p(register, entryPoints)) || []),
|
|
67
51
|
],
|
|
@@ -8,6 +8,7 @@ import featuresPlugin from "./featuresPlugin.js";
|
|
|
8
8
|
|
|
9
9
|
import { isBuiltin } from "node:module";
|
|
10
10
|
import { consoleDetectorPlugin } from "./consoleDetectorPlugin.js";
|
|
11
|
+
import rebuildPlugin from "./rebuildPlugin.js";
|
|
11
12
|
|
|
12
13
|
export default (
|
|
13
14
|
config: ITestconfig,
|
|
@@ -67,24 +68,7 @@ export default (
|
|
|
67
68
|
},
|
|
68
69
|
},
|
|
69
70
|
|
|
70
|
-
|
|
71
|
-
name: "rebuild-notify",
|
|
72
|
-
setup: (build) => {
|
|
73
|
-
build.onStart(() => {
|
|
74
|
-
console.log(`> pure build starting...`);
|
|
75
|
-
});
|
|
76
|
-
build.onEnd((result) => {
|
|
77
|
-
console.log(
|
|
78
|
-
`> pure build ended with ${result.errors.length} errors`
|
|
79
|
-
);
|
|
80
|
-
if (result.errors.length > 0) {
|
|
81
|
-
console.log(result);
|
|
82
|
-
}
|
|
83
|
-
// console.log(result);
|
|
84
|
-
// result.errors.length !== 0 && process.exit(-1);
|
|
85
|
-
});
|
|
86
|
-
},
|
|
87
|
-
},
|
|
71
|
+
rebuildPlugin("pure"),
|
|
88
72
|
|
|
89
73
|
...((config.nodePlugins || []).map((p) => p(register, entryPoints)) ||
|
|
90
74
|
[]),
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
import { IRunTime } from "../lib";
|
|
4
|
+
|
|
5
|
+
export default (r: IRunTime) => {
|
|
6
|
+
return {
|
|
7
|
+
name: "rebuild-notify",
|
|
8
|
+
setup: (build) => {
|
|
9
|
+
build.onStart(() => {
|
|
10
|
+
console.log(`> web build starting...`);
|
|
11
|
+
});
|
|
12
|
+
build.onEnd((result) => {
|
|
13
|
+
console.log(`> web build ended with ${result.errors.length} errors`);
|
|
14
|
+
if (result.errors.length > 0) {
|
|
15
|
+
fs.writeFileSync(
|
|
16
|
+
`./testeranto/reports${r}_build_errors`,
|
|
17
|
+
JSON.stringify(result, null, 2)
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -8,6 +8,7 @@ import { ITestconfig } from "../lib/index.js";
|
|
|
8
8
|
import baseEsBuildConfig from "./index.js";
|
|
9
9
|
import inputFilesPlugin from "./inputFilesPlugin.js";
|
|
10
10
|
import featuresPlugin from "./featuresPlugin.js";
|
|
11
|
+
import rebuildPlugin from "./rebuildPlugin.js";
|
|
11
12
|
|
|
12
13
|
export default (
|
|
13
14
|
config: ITestconfig,
|
|
@@ -68,24 +69,7 @@ export default (
|
|
|
68
69
|
// }
|
|
69
70
|
}),
|
|
70
71
|
|
|
71
|
-
|
|
72
|
-
name: "rebuild-notify",
|
|
73
|
-
setup: (build) => {
|
|
74
|
-
build.onStart(() => {
|
|
75
|
-
console.log(`> web build starting...`);
|
|
76
|
-
});
|
|
77
|
-
build.onEnd((result) => {
|
|
78
|
-
console.log(
|
|
79
|
-
`> web build ended with ${result.errors.length} errors`
|
|
80
|
-
);
|
|
81
|
-
if (result.errors.length > 0) {
|
|
82
|
-
console.log(result);
|
|
83
|
-
}
|
|
84
|
-
// console.log(result);
|
|
85
|
-
// result.errors.length !== 0 && process.exit(-1);
|
|
86
|
-
});
|
|
87
|
-
},
|
|
88
|
-
},
|
|
72
|
+
rebuildPlugin("web"),
|
|
89
73
|
|
|
90
74
|
...((config.webPlugins || []).map((p) => p(register, entryPoints)) || []),
|
|
91
75
|
],
|
package/src/lib/abstractBase.ts
CHANGED
|
@@ -206,7 +206,12 @@ export abstract class BaseGiven<I extends IT = IT> {
|
|
|
206
206
|
return {
|
|
207
207
|
key: this.key,
|
|
208
208
|
name: this.name,
|
|
209
|
-
whens: this.whens.map((w) =>
|
|
209
|
+
whens: this.whens.map((w) => {
|
|
210
|
+
if (w && w.toObj) return w.toObj();
|
|
211
|
+
|
|
212
|
+
console.error("w is not as expected!", w);
|
|
213
|
+
return {};
|
|
214
|
+
}),
|
|
210
215
|
thens: this.thens.map((t) => t.toObj()),
|
|
211
216
|
error: this.error ? [this.error, this.error.stack] : null,
|
|
212
217
|
failed: this.failed,
|
package/src/lib/classBuilder.ts
CHANGED
|
@@ -63,7 +63,6 @@ export abstract class ClassBuilder<
|
|
|
63
63
|
const classyGivens = Object.entries(testImplementation.givens).reduce(
|
|
64
64
|
(a, [key, g]) => {
|
|
65
65
|
a[key] = (features, whens, thens, ...initialValues) => {
|
|
66
|
-
// console.log("givEn", givEn.toString());
|
|
67
66
|
return new givenKlasser.prototype.constructor(
|
|
68
67
|
key,
|
|
69
68
|
features,
|
|
@@ -80,10 +79,10 @@ export abstract class ClassBuilder<
|
|
|
80
79
|
|
|
81
80
|
const classyWhens = Object.entries(testImplementation.whens).reduce(
|
|
82
81
|
(a, [key, whEn]: [string, (x) => any]) => {
|
|
83
|
-
a[key] = (payload
|
|
82
|
+
a[key] = (...payload: any) => {
|
|
84
83
|
return new whenKlasser.prototype.constructor(
|
|
85
84
|
`${whEn.name}: ${payload && payload.toString()}`,
|
|
86
|
-
whEn(payload)
|
|
85
|
+
whEn(...payload)
|
|
87
86
|
);
|
|
88
87
|
};
|
|
89
88
|
return a;
|
|
@@ -91,7 +90,9 @@ export abstract class ClassBuilder<
|
|
|
91
90
|
{}
|
|
92
91
|
);
|
|
93
92
|
|
|
94
|
-
const classyThens = Object.entries<(expected: any, ...x: any[]) => any>(
|
|
93
|
+
const classyThens = Object.entries<(expected: any, ...x: any[]) => any>(
|
|
94
|
+
testImplementation.thens
|
|
95
|
+
).reduce(
|
|
95
96
|
(a, [key, thEn]: [string, (s: I["iselection"]) => I["isubject"]]) => {
|
|
96
97
|
a[key] = (expected, ...x) => {
|
|
97
98
|
return new thenKlasser.prototype.constructor(
|
package/src/lib/core.ts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import {
|
|
3
|
-
ITestSpecification,
|
|
4
|
-
ITestImplementation,
|
|
5
|
-
ITestInterface,
|
|
6
|
-
IT,
|
|
7
|
-
OT,
|
|
8
|
-
} from "../Types.js";
|
|
9
|
-
|
|
10
1
|
import {
|
|
11
2
|
DefaultTestInterface,
|
|
12
3
|
IFinalResults,
|
|
@@ -24,6 +15,11 @@ import {
|
|
|
24
15
|
} from "./abstractBase.js";
|
|
25
16
|
import { ClassBuilder } from "./classBuilder.js";
|
|
26
17
|
import { IPM } from "./types";
|
|
18
|
+
import {
|
|
19
|
+
ITestSpecification,
|
|
20
|
+
ITestImplementation,
|
|
21
|
+
ITestInterface,
|
|
22
|
+
} from "../CoreTypes.js";
|
|
27
23
|
|
|
28
24
|
export default abstract class Testeranto<
|
|
29
25
|
I extends IT,
|
|
Binary file
|
|
Binary file
|