testeranto.tiposkripto 0.2.0 → 0.2.2
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/dist/module/Node.js +361 -154
- package/dist/module/Web.js +362 -171
- package/dist/module/index.js +636 -10
- package/dist/types/Types.d.ts +1 -0
- package/dist/types/lib/tiposkripto/src/BaseAct.d.ts +12 -0
- package/dist/types/lib/tiposkripto/src/BaseAction.d.ts +24 -0
- package/dist/types/lib/tiposkripto/src/BaseArrange.d.ts +11 -0
- package/dist/types/lib/tiposkripto/src/BaseAssert.d.ts +13 -0
- package/dist/types/lib/tiposkripto/src/BaseCheck.d.ts +25 -0
- package/dist/types/lib/tiposkripto/src/BaseFeed.d.ts +15 -0
- package/dist/types/lib/tiposkripto/src/BaseGiven.d.ts +10 -3
- package/dist/types/lib/tiposkripto/src/BaseMap.d.ts +16 -0
- package/dist/types/lib/tiposkripto/src/BaseSetup.d.ts +39 -0
- package/dist/types/lib/tiposkripto/src/BaseSuite.d.ts +3 -3
- package/dist/types/lib/tiposkripto/src/BaseThen.d.ts +9 -3
- package/dist/types/lib/tiposkripto/src/BaseValidate.d.ts +15 -0
- package/dist/types/lib/tiposkripto/src/BaseWhen.d.ts +10 -3
- package/dist/types/lib/tiposkripto/src/CoreTypes.d.ts +29 -24
- package/dist/types/lib/tiposkripto/src/Node.d.ts +3 -3
- package/dist/types/lib/tiposkripto/src/Web.d.ts +3 -3
- package/dist/types/lib/tiposkripto/src/flavored/Decorators.d.ts +22 -0
- package/dist/types/lib/tiposkripto/src/flavored/FluentBuilder.d.ts +31 -0
- package/dist/types/lib/tiposkripto/src/flavored/index.d.ts +17 -0
- package/dist/types/lib/tiposkripto/src/index.d.ts +45 -3
- package/dist/types/lib/tiposkripto/src/types.d.ts +12 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/module/Web.js
CHANGED
|
@@ -1,38 +1,12 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
return input;
|
|
5
|
-
},
|
|
6
|
-
beforeEach: async function(subject, initializer, testResource, initialValues) {
|
|
7
|
-
return subject;
|
|
8
|
-
},
|
|
9
|
-
afterEach: async (store, key) => Promise.resolve(store),
|
|
10
|
-
afterAll: (store) => void 0,
|
|
11
|
-
butThen: async (store, thenCb, testResource) => {
|
|
12
|
-
return thenCb(store);
|
|
13
|
-
},
|
|
14
|
-
andWhen: async (store, whenCB, testResource) => {
|
|
15
|
-
return whenCB(store);
|
|
16
|
-
},
|
|
17
|
-
assertThis: (x) => x
|
|
18
|
-
});
|
|
19
|
-
var DefaultAdapter = (p) => {
|
|
20
|
-
const base = BaseAdapter();
|
|
21
|
-
return {
|
|
22
|
-
...base,
|
|
23
|
-
...p
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
// src/BaseGiven.ts
|
|
28
|
-
var BaseGiven = class {
|
|
29
|
-
constructor(features, whens, thens, givenCB, initialValues) {
|
|
1
|
+
// src/BaseSetup.ts
|
|
2
|
+
var BaseSetup = class {
|
|
3
|
+
constructor(features, actions, checks, setupCB, initialValues) {
|
|
30
4
|
this.artifacts = [];
|
|
31
5
|
this.fails = 0;
|
|
32
6
|
this.features = features;
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
7
|
+
this.actions = actions;
|
|
8
|
+
this.checks = checks;
|
|
9
|
+
this.setupCB = setupCB;
|
|
36
10
|
this.initialValues = initialValues;
|
|
37
11
|
this.fails = 0;
|
|
38
12
|
this.failed = false;
|
|
@@ -52,6 +26,214 @@ var BaseGiven = class {
|
|
|
52
26
|
const normalizedPath = path.replace(/\\/g, "/");
|
|
53
27
|
this.artifacts.push(normalizedPath);
|
|
54
28
|
}
|
|
29
|
+
toObj() {
|
|
30
|
+
return {
|
|
31
|
+
key: this.key,
|
|
32
|
+
actions: (this.actions || []).map((a) => {
|
|
33
|
+
if (a && a.toObj) return a.toObj();
|
|
34
|
+
console.error("Action step is not as expected!", JSON.stringify(a));
|
|
35
|
+
return {};
|
|
36
|
+
}),
|
|
37
|
+
checks: (this.checks || []).map((c) => c && c.toObj ? c.toObj() : {}),
|
|
38
|
+
error: this.error ? [this.error, this.error.stack] : null,
|
|
39
|
+
failed: this.failed,
|
|
40
|
+
features: this.features || [],
|
|
41
|
+
artifacts: this.artifacts,
|
|
42
|
+
status: this.status
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
async afterEach(store, key, artifactory) {
|
|
46
|
+
return store;
|
|
47
|
+
}
|
|
48
|
+
async setup(subject, key, testResourceConfiguration, tester, artifactory, suiteNdx) {
|
|
49
|
+
this.key = key;
|
|
50
|
+
this.fails = 0;
|
|
51
|
+
const actualArtifactory = artifactory || ((fPath, value) => {
|
|
52
|
+
});
|
|
53
|
+
const setupArtifactory = (fPath, value) => actualArtifactory(`setup-${key}/${fPath}`, value);
|
|
54
|
+
try {
|
|
55
|
+
this.store = await this.setupThat(
|
|
56
|
+
subject,
|
|
57
|
+
testResourceConfiguration,
|
|
58
|
+
setupArtifactory,
|
|
59
|
+
this.setupCB,
|
|
60
|
+
this.initialValues
|
|
61
|
+
);
|
|
62
|
+
this.status = true;
|
|
63
|
+
} catch (e) {
|
|
64
|
+
this.status = false;
|
|
65
|
+
this.failed = true;
|
|
66
|
+
this.fails++;
|
|
67
|
+
this.error = e;
|
|
68
|
+
return this.store;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
for (const [actionNdx, actionStep] of (this.actions || []).entries()) {
|
|
72
|
+
try {
|
|
73
|
+
this.store = await actionStep.test(
|
|
74
|
+
this.store,
|
|
75
|
+
testResourceConfiguration
|
|
76
|
+
);
|
|
77
|
+
} catch (e) {
|
|
78
|
+
this.failed = true;
|
|
79
|
+
this.fails++;
|
|
80
|
+
this.error = e;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
for (const [checkNdx, checkStep] of this.checks.entries()) {
|
|
84
|
+
try {
|
|
85
|
+
const filepath = suiteNdx !== void 0 ? `suite-${suiteNdx}/setup-${key}/check-${checkNdx}` : `setup-${key}/check-${checkNdx}`;
|
|
86
|
+
const t = await checkStep.test(
|
|
87
|
+
this.store,
|
|
88
|
+
testResourceConfiguration,
|
|
89
|
+
filepath
|
|
90
|
+
);
|
|
91
|
+
tester(t);
|
|
92
|
+
} catch (e) {
|
|
93
|
+
this.failed = true;
|
|
94
|
+
this.fails++;
|
|
95
|
+
this.error = e;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
} catch (e) {
|
|
99
|
+
this.error = e;
|
|
100
|
+
this.failed = true;
|
|
101
|
+
this.fails++;
|
|
102
|
+
} finally {
|
|
103
|
+
try {
|
|
104
|
+
await this.afterEach(this.store, this.key, setupArtifactory);
|
|
105
|
+
} catch (e) {
|
|
106
|
+
this.failed = true;
|
|
107
|
+
this.fails++;
|
|
108
|
+
this.error = e;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return this.store;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// src/BaseAction.ts
|
|
116
|
+
var BaseAction = class {
|
|
117
|
+
constructor(name, actionCB) {
|
|
118
|
+
this.artifacts = [];
|
|
119
|
+
this.name = name;
|
|
120
|
+
this.actionCB = actionCB;
|
|
121
|
+
}
|
|
122
|
+
addArtifact(path) {
|
|
123
|
+
if (typeof path !== "string") {
|
|
124
|
+
throw new Error(
|
|
125
|
+
`[ARTIFACT ERROR] Expected string, got ${typeof path}: ${JSON.stringify(
|
|
126
|
+
path
|
|
127
|
+
)}`
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
const normalizedPath = path.replace(/\\/g, "/");
|
|
131
|
+
this.artifacts.push(normalizedPath);
|
|
132
|
+
}
|
|
133
|
+
toObj() {
|
|
134
|
+
const obj = {
|
|
135
|
+
name: this.name,
|
|
136
|
+
status: this.status,
|
|
137
|
+
error: this.error ? `${this.error.name}: ${this.error.message}
|
|
138
|
+
${this.error.stack}` : null,
|
|
139
|
+
artifacts: this.artifacts
|
|
140
|
+
};
|
|
141
|
+
return obj;
|
|
142
|
+
}
|
|
143
|
+
async test(store, testResourceConfiguration) {
|
|
144
|
+
try {
|
|
145
|
+
const result = await this.performAction(
|
|
146
|
+
store,
|
|
147
|
+
this.actionCB,
|
|
148
|
+
testResourceConfiguration
|
|
149
|
+
);
|
|
150
|
+
this.status = true;
|
|
151
|
+
return result;
|
|
152
|
+
} catch (e) {
|
|
153
|
+
this.status = false;
|
|
154
|
+
this.error = e;
|
|
155
|
+
throw e;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// src/BaseCheck.ts
|
|
161
|
+
var BaseCheck = class {
|
|
162
|
+
constructor(name, checkCB) {
|
|
163
|
+
this.artifacts = [];
|
|
164
|
+
this.name = name;
|
|
165
|
+
this.checkCB = checkCB;
|
|
166
|
+
this.error = false;
|
|
167
|
+
this.artifacts = [];
|
|
168
|
+
}
|
|
169
|
+
addArtifact(path) {
|
|
170
|
+
if (typeof path !== "string") {
|
|
171
|
+
throw new Error(
|
|
172
|
+
`[ARTIFACT ERROR] Expected string, got ${typeof path}: ${JSON.stringify(
|
|
173
|
+
path
|
|
174
|
+
)}`
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
const normalizedPath = path.replace(/\\/g, "/");
|
|
178
|
+
this.artifacts.push(normalizedPath);
|
|
179
|
+
}
|
|
180
|
+
toObj() {
|
|
181
|
+
const obj = {
|
|
182
|
+
name: this.name,
|
|
183
|
+
error: this.error,
|
|
184
|
+
artifacts: this.artifacts,
|
|
185
|
+
status: this.status
|
|
186
|
+
};
|
|
187
|
+
return obj;
|
|
188
|
+
}
|
|
189
|
+
async test(store, testResourceConfiguration, filepath) {
|
|
190
|
+
const addArtifact = this.addArtifact.bind(this);
|
|
191
|
+
try {
|
|
192
|
+
const x = await this.verifyCheck(
|
|
193
|
+
store,
|
|
194
|
+
async (s) => {
|
|
195
|
+
try {
|
|
196
|
+
if (typeof this.checkCB === "function") {
|
|
197
|
+
const result = await this.checkCB(s);
|
|
198
|
+
return result;
|
|
199
|
+
} else {
|
|
200
|
+
return this.checkCB;
|
|
201
|
+
}
|
|
202
|
+
} catch (e) {
|
|
203
|
+
this.error = true;
|
|
204
|
+
throw e;
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
testResourceConfiguration
|
|
208
|
+
);
|
|
209
|
+
this.status = true;
|
|
210
|
+
return x;
|
|
211
|
+
} catch (e) {
|
|
212
|
+
this.status = false;
|
|
213
|
+
this.error = true;
|
|
214
|
+
throw e;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
// src/BaseGiven.ts
|
|
220
|
+
var BaseGiven = class extends BaseSetup {
|
|
221
|
+
constructor(features, whens, thens, givenCB, initialValues) {
|
|
222
|
+
super(features, whens, thens, givenCB, initialValues);
|
|
223
|
+
this.artifacts = [];
|
|
224
|
+
this.fails = 0;
|
|
225
|
+
}
|
|
226
|
+
addArtifact(path) {
|
|
227
|
+
if (typeof path !== "string") {
|
|
228
|
+
throw new Error(
|
|
229
|
+
`[ARTIFACT ERROR] Expected string, got ${typeof path}: ${JSON.stringify(
|
|
230
|
+
path
|
|
231
|
+
)}`
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
const normalizedPath = path.replace(/\\/g, "/");
|
|
235
|
+
this.artifacts.push(normalizedPath);
|
|
236
|
+
}
|
|
55
237
|
beforeAll(store) {
|
|
56
238
|
return store;
|
|
57
239
|
}
|
|
@@ -71,6 +253,10 @@ var BaseGiven = class {
|
|
|
71
253
|
status: this.status
|
|
72
254
|
};
|
|
73
255
|
}
|
|
256
|
+
// Implement BaseSetup's abstract method
|
|
257
|
+
async setupThat(subject, testResourceConfiguration, artifactory, setupCB, initialValues) {
|
|
258
|
+
return this.givenThat(subject, testResourceConfiguration, artifactory, setupCB, initialValues);
|
|
259
|
+
}
|
|
74
260
|
async afterEach(store, key, artifactory) {
|
|
75
261
|
return store;
|
|
76
262
|
}
|
|
@@ -142,6 +328,141 @@ var BaseGiven = class {
|
|
|
142
328
|
}
|
|
143
329
|
};
|
|
144
330
|
|
|
331
|
+
// src/BaseWhen.ts
|
|
332
|
+
var BaseWhen = class extends BaseAction {
|
|
333
|
+
constructor(name, whenCB) {
|
|
334
|
+
super(name, whenCB);
|
|
335
|
+
this.artifacts = [];
|
|
336
|
+
}
|
|
337
|
+
addArtifact(path) {
|
|
338
|
+
if (typeof path !== "string") {
|
|
339
|
+
throw new Error(
|
|
340
|
+
`[ARTIFACT ERROR] Expected string, got ${typeof path}: ${JSON.stringify(
|
|
341
|
+
path
|
|
342
|
+
)}`
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
const normalizedPath = path.replace(/\\/g, "/");
|
|
346
|
+
this.artifacts.push(normalizedPath);
|
|
347
|
+
}
|
|
348
|
+
// Implement BaseAction's abstract method
|
|
349
|
+
async performAction(store, actionCB, testResource) {
|
|
350
|
+
return this.andWhen(store, actionCB, testResource);
|
|
351
|
+
}
|
|
352
|
+
toObj() {
|
|
353
|
+
const obj = {
|
|
354
|
+
name: this.name,
|
|
355
|
+
status: this.status,
|
|
356
|
+
error: this.error ? `${this.error.name}: ${this.error.message}
|
|
357
|
+
${this.error.stack}` : null,
|
|
358
|
+
artifacts: this.artifacts
|
|
359
|
+
};
|
|
360
|
+
return obj;
|
|
361
|
+
}
|
|
362
|
+
async test(store, testResourceConfiguration) {
|
|
363
|
+
try {
|
|
364
|
+
const result = await this.andWhen(
|
|
365
|
+
store,
|
|
366
|
+
this.whenCB,
|
|
367
|
+
testResourceConfiguration
|
|
368
|
+
// proxiedPm
|
|
369
|
+
);
|
|
370
|
+
this.status = true;
|
|
371
|
+
return result;
|
|
372
|
+
} catch (e) {
|
|
373
|
+
this.status = false;
|
|
374
|
+
this.error = e;
|
|
375
|
+
throw e;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
// src/BaseThen.ts
|
|
381
|
+
var BaseThen = class extends BaseCheck {
|
|
382
|
+
constructor(name, thenCB) {
|
|
383
|
+
this.artifacts = [];
|
|
384
|
+
this.name = name;
|
|
385
|
+
this.thenCB = thenCB;
|
|
386
|
+
this.error = false;
|
|
387
|
+
this.artifacts = [];
|
|
388
|
+
}
|
|
389
|
+
addArtifact(path) {
|
|
390
|
+
if (typeof path !== "string") {
|
|
391
|
+
throw new Error(
|
|
392
|
+
`[ARTIFACT ERROR] Expected string, got ${typeof path}: ${JSON.stringify(
|
|
393
|
+
path
|
|
394
|
+
)}`
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
const normalizedPath = path.replace(/\\/g, "/");
|
|
398
|
+
this.artifacts.push(normalizedPath);
|
|
399
|
+
}
|
|
400
|
+
toObj() {
|
|
401
|
+
const obj = {
|
|
402
|
+
name: this.name,
|
|
403
|
+
error: this.error,
|
|
404
|
+
artifacts: this.artifacts,
|
|
405
|
+
status: this.status
|
|
406
|
+
};
|
|
407
|
+
return obj;
|
|
408
|
+
}
|
|
409
|
+
async test(store, testResourceConfiguration, filepath) {
|
|
410
|
+
const addArtifact = this.addArtifact.bind(this);
|
|
411
|
+
try {
|
|
412
|
+
const x = await this.butThen(
|
|
413
|
+
store,
|
|
414
|
+
async (s) => {
|
|
415
|
+
try {
|
|
416
|
+
if (typeof this.thenCB === "function") {
|
|
417
|
+
const result = await this.thenCB(s);
|
|
418
|
+
return result;
|
|
419
|
+
} else {
|
|
420
|
+
return this.thenCB;
|
|
421
|
+
}
|
|
422
|
+
} catch (e) {
|
|
423
|
+
this.error = true;
|
|
424
|
+
throw e;
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
testResourceConfiguration
|
|
428
|
+
// proxiedPm
|
|
429
|
+
);
|
|
430
|
+
this.status = true;
|
|
431
|
+
return x;
|
|
432
|
+
} catch (e) {
|
|
433
|
+
this.status = false;
|
|
434
|
+
this.error = true;
|
|
435
|
+
throw e;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
// src/index.ts
|
|
441
|
+
var BaseAdapter = () => ({
|
|
442
|
+
prepareAll: async (input, testResource) => {
|
|
443
|
+
return input;
|
|
444
|
+
},
|
|
445
|
+
prepareEach: async function(subject, initializer, testResource, initialValues) {
|
|
446
|
+
return subject;
|
|
447
|
+
},
|
|
448
|
+
cleanupEach: async (store, key) => Promise.resolve(store),
|
|
449
|
+
cleanupAll: (store) => void 0,
|
|
450
|
+
verify: async (store, checkCb, testResource) => {
|
|
451
|
+
return checkCb(store);
|
|
452
|
+
},
|
|
453
|
+
execute: async (store, actionCB, testResource) => {
|
|
454
|
+
return actionCB(store);
|
|
455
|
+
},
|
|
456
|
+
assert: (x) => x
|
|
457
|
+
});
|
|
458
|
+
var DefaultAdapter = (p) => {
|
|
459
|
+
const base = BaseAdapter();
|
|
460
|
+
return {
|
|
461
|
+
...base,
|
|
462
|
+
...p
|
|
463
|
+
};
|
|
464
|
+
};
|
|
465
|
+
|
|
145
466
|
// src/BaseSuite.ts
|
|
146
467
|
var BaseSuite = class {
|
|
147
468
|
constructor(name, index, givens = {}) {
|
|
@@ -251,112 +572,6 @@ var BaseSuite = class {
|
|
|
251
572
|
}
|
|
252
573
|
};
|
|
253
574
|
|
|
254
|
-
// src/BaseThen.ts
|
|
255
|
-
var BaseThen = class {
|
|
256
|
-
constructor(name, thenCB) {
|
|
257
|
-
this.artifacts = [];
|
|
258
|
-
this.name = name;
|
|
259
|
-
this.thenCB = thenCB;
|
|
260
|
-
this.error = false;
|
|
261
|
-
this.artifacts = [];
|
|
262
|
-
}
|
|
263
|
-
addArtifact(path) {
|
|
264
|
-
if (typeof path !== "string") {
|
|
265
|
-
throw new Error(
|
|
266
|
-
`[ARTIFACT ERROR] Expected string, got ${typeof path}: ${JSON.stringify(
|
|
267
|
-
path
|
|
268
|
-
)}`
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
const normalizedPath = path.replace(/\\/g, "/");
|
|
272
|
-
this.artifacts.push(normalizedPath);
|
|
273
|
-
}
|
|
274
|
-
toObj() {
|
|
275
|
-
const obj = {
|
|
276
|
-
name: this.name,
|
|
277
|
-
error: this.error,
|
|
278
|
-
artifacts: this.artifacts,
|
|
279
|
-
status: this.status
|
|
280
|
-
};
|
|
281
|
-
return obj;
|
|
282
|
-
}
|
|
283
|
-
async test(store, testResourceConfiguration, filepath) {
|
|
284
|
-
const addArtifact = this.addArtifact.bind(this);
|
|
285
|
-
try {
|
|
286
|
-
const x = await this.butThen(
|
|
287
|
-
store,
|
|
288
|
-
async (s) => {
|
|
289
|
-
try {
|
|
290
|
-
if (typeof this.thenCB === "function") {
|
|
291
|
-
const result = await this.thenCB(s);
|
|
292
|
-
return result;
|
|
293
|
-
} else {
|
|
294
|
-
return this.thenCB;
|
|
295
|
-
}
|
|
296
|
-
} catch (e) {
|
|
297
|
-
this.error = true;
|
|
298
|
-
throw e;
|
|
299
|
-
}
|
|
300
|
-
},
|
|
301
|
-
testResourceConfiguration
|
|
302
|
-
// proxiedPm
|
|
303
|
-
);
|
|
304
|
-
this.status = true;
|
|
305
|
-
return x;
|
|
306
|
-
} catch (e) {
|
|
307
|
-
this.status = false;
|
|
308
|
-
this.error = true;
|
|
309
|
-
throw e;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
// src/BaseWhen.ts
|
|
315
|
-
var BaseWhen = class {
|
|
316
|
-
constructor(name, whenCB) {
|
|
317
|
-
this.artifacts = [];
|
|
318
|
-
this.name = name;
|
|
319
|
-
this.whenCB = whenCB;
|
|
320
|
-
}
|
|
321
|
-
addArtifact(path) {
|
|
322
|
-
if (typeof path !== "string") {
|
|
323
|
-
throw new Error(
|
|
324
|
-
`[ARTIFACT ERROR] Expected string, got ${typeof path}: ${JSON.stringify(
|
|
325
|
-
path
|
|
326
|
-
)}`
|
|
327
|
-
);
|
|
328
|
-
}
|
|
329
|
-
const normalizedPath = path.replace(/\\/g, "/");
|
|
330
|
-
this.artifacts.push(normalizedPath);
|
|
331
|
-
}
|
|
332
|
-
toObj() {
|
|
333
|
-
const obj = {
|
|
334
|
-
name: this.name,
|
|
335
|
-
status: this.status,
|
|
336
|
-
error: this.error ? `${this.error.name}: ${this.error.message}
|
|
337
|
-
${this.error.stack}` : null,
|
|
338
|
-
artifacts: this.artifacts
|
|
339
|
-
};
|
|
340
|
-
return obj;
|
|
341
|
-
}
|
|
342
|
-
async test(store, testResourceConfiguration) {
|
|
343
|
-
try {
|
|
344
|
-
const result = await this.andWhen(
|
|
345
|
-
store,
|
|
346
|
-
this.whenCB,
|
|
347
|
-
testResourceConfiguration
|
|
348
|
-
// proxiedPm
|
|
349
|
-
);
|
|
350
|
-
this.status = true;
|
|
351
|
-
return result;
|
|
352
|
-
} catch (e) {
|
|
353
|
-
this.status = false;
|
|
354
|
-
this.error = e;
|
|
355
|
-
throw e;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
|
|
360
575
|
// src/types.ts
|
|
361
576
|
var defaultTestResourceRequirement = {
|
|
362
577
|
ports: 0
|
|
@@ -381,13 +596,13 @@ var BaseTiposkripto = class {
|
|
|
381
596
|
a[key] = (somestring, givens) => {
|
|
382
597
|
return new class extends BaseSuite {
|
|
383
598
|
afterAll(store) {
|
|
384
|
-
return fullAdapter.
|
|
599
|
+
return fullAdapter.cleanupAll(store);
|
|
385
600
|
}
|
|
386
601
|
assertThat(t) {
|
|
387
|
-
return fullAdapter.
|
|
602
|
+
return fullAdapter.assert(t);
|
|
388
603
|
}
|
|
389
604
|
async setup(s, tr) {
|
|
390
|
-
return fullAdapter.
|
|
605
|
+
return fullAdapter.prepareAll?.(s, tr) ?? s;
|
|
391
606
|
}
|
|
392
607
|
}(somestring, index, givens);
|
|
393
608
|
};
|
|
@@ -403,7 +618,7 @@ var BaseTiposkripto = class {
|
|
|
403
618
|
const safeThens = Array.isArray(thens) ? [...thens] : [];
|
|
404
619
|
return new class extends BaseGiven {
|
|
405
620
|
async givenThat(subject, testResource, initializer, initialValues2) {
|
|
406
|
-
return fullAdapter.
|
|
621
|
+
return fullAdapter.prepareEach(
|
|
407
622
|
subject,
|
|
408
623
|
initializer,
|
|
409
624
|
testResource,
|
|
@@ -411,7 +626,7 @@ var BaseTiposkripto = class {
|
|
|
411
626
|
);
|
|
412
627
|
}
|
|
413
628
|
afterEach(store, key2) {
|
|
414
|
-
return Promise.resolve(fullAdapter.
|
|
629
|
+
return Promise.resolve(fullAdapter.cleanupEach(store, key2));
|
|
415
630
|
}
|
|
416
631
|
}(
|
|
417
632
|
safeFeatures,
|
|
@@ -430,7 +645,7 @@ var BaseTiposkripto = class {
|
|
|
430
645
|
a[key] = (...payload) => {
|
|
431
646
|
const whenInstance = new class extends BaseWhen {
|
|
432
647
|
async andWhen(store, whenCB, testResource) {
|
|
433
|
-
return await fullAdapter.
|
|
648
|
+
return await fullAdapter.execute(store, whenCB, testResource);
|
|
434
649
|
}
|
|
435
650
|
}(`${key}: ${payload && payload.toString()}`, whEn(...payload));
|
|
436
651
|
return whenInstance;
|
|
@@ -444,7 +659,7 @@ var BaseTiposkripto = class {
|
|
|
444
659
|
a[key] = (...args) => {
|
|
445
660
|
const thenInstance = new class extends BaseThen {
|
|
446
661
|
async butThen(store, thenCB, testResource) {
|
|
447
|
-
return await fullAdapter.
|
|
662
|
+
return await fullAdapter.verify(store, thenCB, testResource);
|
|
448
663
|
}
|
|
449
664
|
}(`${key}: ${args && args.toString()}`, thEn(...args));
|
|
450
665
|
return thenInstance;
|
|
@@ -471,15 +686,7 @@ var BaseTiposkripto = class {
|
|
|
471
686
|
try {
|
|
472
687
|
const x = await suite2.run(
|
|
473
688
|
input,
|
|
474
|
-
testResourceConfiguration2
|
|
475
|
-
name: suite2.name,
|
|
476
|
-
fs: process.cwd(),
|
|
477
|
-
ports: [],
|
|
478
|
-
timeout: 3e4,
|
|
479
|
-
retries: 3,
|
|
480
|
-
environment: {},
|
|
481
|
-
files: []
|
|
482
|
-
}
|
|
689
|
+
testResourceConfiguration2
|
|
483
690
|
);
|
|
484
691
|
return x;
|
|
485
692
|
} catch (e) {
|
|
@@ -603,23 +810,7 @@ var WebTiposkripto = class extends BaseTiposkripto {
|
|
|
603
810
|
);
|
|
604
811
|
}
|
|
605
812
|
writeFileSync(filename, payload) {
|
|
606
|
-
|
|
607
|
-
window.__testeranto_files__ = {};
|
|
608
|
-
}
|
|
609
|
-
window.__testeranto_files__[filename] = payload;
|
|
610
|
-
if (navigator.storage && navigator.storage.getDirectory) {
|
|
611
|
-
(async () => {
|
|
612
|
-
try {
|
|
613
|
-
const root = await navigator.storage.getDirectory();
|
|
614
|
-
const fileHandle = await root.getFileHandle(filename, { create: true });
|
|
615
|
-
const writable = await fileHandle.createWritable();
|
|
616
|
-
await writable.write(payload);
|
|
617
|
-
await writable.close();
|
|
618
|
-
} catch (e) {
|
|
619
|
-
console.warn("Could not write to browser storage:", e);
|
|
620
|
-
}
|
|
621
|
-
})();
|
|
622
|
-
}
|
|
813
|
+
window.__writeFile(filename, payload);
|
|
623
814
|
}
|
|
624
815
|
};
|
|
625
816
|
var tiposkripto = async (input, testSpecification, testImplementation, testAdapter, testResourceRequirement = defaultTestResourceRequirement) => {
|