testeranto 0.90.0 → 0.100.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/bundle.js +4 -7
- package/dist/common/src/Node.js +5 -3
- package/dist/common/src/PM/main.js +254 -126
- package/dist/common/src/PM/node.js +20 -5
- package/dist/common/src/PM/web.js +19 -4
- package/dist/common/src/SubPackages/puppeteer.js +1 -1
- package/dist/common/src/SubPackages/react/jsx/index.js +14 -6
- package/dist/common/src/SubPackages/react/jsx/node.js +2 -2
- package/dist/common/src/SubPackages/react-dom/component/web.js +13 -39
- package/dist/common/src/SubPackages/react-test-renderer/component/interface.js +2 -10
- package/dist/common/src/Web.js +25 -21
- package/dist/common/src/cli.js +439 -0
- package/dist/common/src/cli2.js +144 -0
- package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +18 -8
- package/dist/common/src/esbuildConfigs/node.js +1 -4
- package/dist/common/src/esbuildConfigs/web.js +1 -1
- package/dist/common/src/lib/abstractBase.js +31 -263
- package/dist/common/src/lib/basebuilder.js +1 -11
- package/dist/common/src/lib/classBuilder.js +1 -1
- package/dist/common/src/lib/core.js +8 -28
- package/dist/common/src/lib/types.js +1 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/src/Node.js +5 -3
- package/dist/module/src/PM/main.js +254 -126
- package/dist/module/src/PM/node.js +20 -5
- package/dist/module/src/PM/web.js +19 -4
- package/dist/module/src/SubPackages/puppeteer.js +1 -1
- package/dist/module/src/SubPackages/react/jsx/index.js +14 -6
- package/dist/module/src/SubPackages/react/jsx/node.js +2 -2
- package/dist/module/src/SubPackages/react-dom/component/web.js +13 -39
- package/dist/module/src/SubPackages/react-test-renderer/component/interface.js +2 -10
- package/dist/module/src/Web.js +25 -21
- package/dist/module/src/cli.js +411 -0
- package/dist/module/src/cli2.js +116 -0
- package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +18 -8
- package/dist/module/src/esbuildConfigs/node.js +1 -4
- package/dist/module/src/esbuildConfigs/web.js +1 -1
- package/dist/module/src/lib/abstractBase.js +31 -263
- package/dist/module/src/lib/basebuilder.js +1 -11
- package/dist/module/src/lib/classBuilder.js +1 -1
- package/dist/module/src/lib/core.js +8 -28
- package/dist/module/src/lib/types.js +1 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/cli.mjs +1491 -0
- package/dist/prebuild/{run-tests.mjs → cli2.mjs} +223 -212
- package/dist/types/src/Node.d.ts +6 -3
- package/dist/types/src/PM/index.d.ts +10 -2
- package/dist/types/src/PM/main.d.ts +14 -7
- package/dist/types/src/PM/node.d.ts +9 -2
- package/dist/types/src/PM/web.d.ts +9 -3
- package/dist/types/src/SubPackages/puppeteer.d.ts +1 -1
- package/dist/types/src/SubPackages/react/component/node.d.ts +1 -1
- package/dist/types/src/SubPackages/react/component/web.d.ts +1 -1
- package/dist/types/src/SubPackages/react/jsx/node.d.ts +3 -3
- package/dist/types/src/SubPackages/react/jsx/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-dom/component/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-dom/component/web.d.ts +1 -1
- package/dist/types/src/SubPackages/react-dom/jsx/node.d.ts +1 -1
- package/dist/types/src/SubPackages/react-dom/jsx/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/component/interface.d.ts +1 -1
- package/dist/types/src/SubPackages/react-test-renderer/component/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/component/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/fc/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/fc/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/jsx/node.d.ts +3 -2
- package/dist/types/src/SubPackages/react-test-renderer/jsx/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/web.d.ts +2 -2
- package/dist/types/src/Types.d.ts +60 -21
- package/dist/types/src/Web.d.ts +3 -3
- package/dist/types/src/lib/abstractBase.d.ts +6 -2
- package/dist/types/src/lib/core.d.ts +3 -3
- package/dist/types/src/lib/index.d.ts +1 -1
- package/dist/types/src/lib/types.d.ts +6 -30
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +23 -20
- package/src/Node.ts +6 -3
- package/src/PM/index.ts +12 -8
- package/src/PM/main.ts +331 -165
- package/src/PM/node.ts +42 -7
- package/src/PM/web.ts +33 -5
- package/src/SubPackages/puppeteer.ts +1 -1
- package/src/SubPackages/react/jsx/index.ts +15 -7
- package/src/SubPackages/react/jsx/node.ts +18 -6
- package/src/SubPackages/react-dom/component/web.ts +28 -51
- package/src/SubPackages/react-test-renderer/component/interface.ts +4 -11
- package/src/SubPackages/react-test-renderer/jsx/node.ts +16 -1
- package/src/Types.ts +362 -114
- package/src/Web.ts +45 -23
- package/src/cli.ts +535 -0
- package/src/cli2.ts +157 -0
- package/src/esbuildConfigs/inputFilesPlugin.ts +27 -9
- package/src/esbuildConfigs/node.ts +4 -7
- package/src/esbuildConfigs/web.ts +4 -3
- package/src/lib/abstractBase.ts +84 -291
- package/src/lib/basebuilder.ts +1 -12
- package/src/lib/classBuilder.ts +2 -1
- package/src/lib/core.ts +17 -29
- package/src/lib/types.ts +5 -177
- package/dist/common/src/Aider.js +0 -143
- package/dist/common/src/Project.js +0 -225
- package/dist/common/src/Puppeteer.js +0 -113
- package/dist/common/src/build-tests.js +0 -39
- package/dist/common/src/esbuildConfigs/features.js +0 -14
- package/dist/common/src/esbuildConfigs/report.js +0 -14
- package/dist/common/src/esbuildConfigs/tests.js +0 -13
- package/dist/common/src/run-tests.js +0 -39
- package/dist/module/src/Aider.js +0 -136
- package/dist/module/src/Project.js +0 -218
- package/dist/module/src/Puppeteer.js +0 -108
- package/dist/module/src/build-tests.js +0 -11
- package/dist/module/src/esbuildConfigs/features.js +0 -12
- package/dist/module/src/esbuildConfigs/report.js +0 -14
- package/dist/module/src/esbuildConfigs/tests.js +0 -11
- package/dist/module/src/run-tests.js +0 -11
- package/dist/prebuild/build-tests.mjs +0 -552
- package/dist/types/src/Aider.d.ts +0 -1
- package/dist/types/src/Project.d.ts +0 -12
- package/dist/types/src/Puppeteer.d.ts +0 -2
- package/dist/types/src/esbuildConfigs/features.d.ts +0 -4
- package/dist/types/src/esbuildConfigs/report.d.ts +0 -0
- package/dist/types/src/esbuildConfigs/tests.d.ts +0 -4
- package/src/Aider.ts +0 -168
- package/src/Project.ts +0 -291
- package/src/Puppeteer.ts +0 -145
- package/src/build-tests.ts +0 -12
- package/src/esbuildConfigs/features.ts +0 -17
- package/src/esbuildConfigs/report.ts +0 -15
- package/src/esbuildConfigs/tests.ts +0 -14
- package/src/run-tests.ts +0 -12
- /package/dist/types/src/{build-tests.d.ts → cli.d.ts} +0 -0
- /package/dist/types/src/{run-tests.d.ts → cli2.d.ts} +0 -0
package/src/lib/basebuilder.ts
CHANGED
|
@@ -82,7 +82,6 @@ export abstract class BaseBuilder<
|
|
|
82
82
|
this.Check()
|
|
83
83
|
);
|
|
84
84
|
|
|
85
|
-
// const f = this.specs[0].features;
|
|
86
85
|
this.testJobs = this.specs.map((suite: BaseSuite<ITestShape>) => {
|
|
87
86
|
const suiteRunner =
|
|
88
87
|
(suite: BaseSuite<ITestShape>) =>
|
|
@@ -90,14 +89,6 @@ export abstract class BaseBuilder<
|
|
|
90
89
|
puppetMaster: PM,
|
|
91
90
|
tLog: ITLog
|
|
92
91
|
): Promise<BaseSuite<ITestShape>> => {
|
|
93
|
-
// const puppeteerBrowser = await puppetMaster.startPuppeteer(
|
|
94
|
-
// {
|
|
95
|
-
// browserWSEndpoint:
|
|
96
|
-
// puppetMaster.testResourceConfiguration.browserWSEndpoint,
|
|
97
|
-
// },
|
|
98
|
-
// puppetMaster.testResourceConfiguration.fs
|
|
99
|
-
// );
|
|
100
|
-
|
|
101
92
|
const x = await suite.run(
|
|
102
93
|
input,
|
|
103
94
|
puppetMaster.testResourceConfiguration,
|
|
@@ -112,8 +103,6 @@ export abstract class BaseBuilder<
|
|
|
112
103
|
puppetMaster
|
|
113
104
|
);
|
|
114
105
|
|
|
115
|
-
// await puppetMaster.browser.disconnect();
|
|
116
|
-
// puppeteerBrowser.close();
|
|
117
106
|
return x;
|
|
118
107
|
};
|
|
119
108
|
|
|
@@ -163,7 +152,7 @@ export abstract class BaseBuilder<
|
|
|
163
152
|
`tests.json`,
|
|
164
153
|
JSON.stringify(this.toObj(), null, 2)
|
|
165
154
|
);
|
|
166
|
-
console.log(`exiting gracefully with ${numberOfFailures} failures.`);
|
|
155
|
+
// console.log(`exiting gracefully with ${numberOfFailures} failures.`);
|
|
167
156
|
|
|
168
157
|
return {
|
|
169
158
|
failed: numberOfFailures,
|
package/src/lib/classBuilder.ts
CHANGED
|
@@ -57,8 +57,9 @@ export abstract class ClassBuilder<
|
|
|
57
57
|
},
|
|
58
58
|
{}
|
|
59
59
|
);
|
|
60
|
+
|
|
60
61
|
const classyGivens = Object.entries(testImplementation.givens).reduce(
|
|
61
|
-
(a, [key,
|
|
62
|
+
(a, [key, g]) => {
|
|
62
63
|
a[key] = (features, whens, thens, givEn) => {
|
|
63
64
|
return new givenKlasser.prototype.constructor(
|
|
64
65
|
key,
|
package/src/lib/core.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
ITestImplementation,
|
|
6
6
|
} from "../Types.js";
|
|
7
7
|
|
|
8
|
-
import { ITestInterface } from "./types.js";
|
|
8
|
+
import { IFinalResults, ITestInterface } from "./types.js";
|
|
9
9
|
import {
|
|
10
10
|
DefaultTestInterface,
|
|
11
11
|
ITTestResourceRequest,
|
|
@@ -43,9 +43,11 @@ export default abstract class Testeranto<
|
|
|
43
43
|
testSpecification: ITestSpecification<ITestShape>,
|
|
44
44
|
testImplementation: ITestImplementation<ITestShape>,
|
|
45
45
|
testResourceRequirement: ITTestResourceRequest = defaultTestResourceRequirement,
|
|
46
|
-
testInterface: Partial<ITestInterface<ITestShape
|
|
46
|
+
testInterface: Partial<ITestInterface<ITestShape>>,
|
|
47
|
+
uberCatcher: (cb) => void
|
|
47
48
|
) {
|
|
48
49
|
const fullTestInterface = DefaultTestInterface(testInterface);
|
|
50
|
+
|
|
49
51
|
super(
|
|
50
52
|
testImplementation,
|
|
51
53
|
testSpecification,
|
|
@@ -53,26 +55,6 @@ export default abstract class Testeranto<
|
|
|
53
55
|
|
|
54
56
|
class extends BaseSuite<ITestShape> {
|
|
55
57
|
afterAll(store: IStore, artifactory: ITestArtifactory, pm: PM) {
|
|
56
|
-
// const pagesHandler = {
|
|
57
|
-
// get(target, prop) {
|
|
58
|
-
// console.log(`Getting pages property ${prop}`);
|
|
59
|
-
// return target[prop];
|
|
60
|
-
// },
|
|
61
|
-
// };
|
|
62
|
-
|
|
63
|
-
// const browserHandler = {
|
|
64
|
-
// get(target, prop) {
|
|
65
|
-
// console.log(`Getting browser property ${prop}`);
|
|
66
|
-
// if (prop === "pages") {
|
|
67
|
-
// // return target[prop];
|
|
68
|
-
// return new Proxy(target[prop], pagesHandler);
|
|
69
|
-
// } else {
|
|
70
|
-
// return target[prop];
|
|
71
|
-
// }
|
|
72
|
-
// },
|
|
73
|
-
// };
|
|
74
|
-
// const proxy = new Proxy(utils.browser, browserHandler);
|
|
75
|
-
|
|
76
58
|
return fullTestInterface.afterAll(
|
|
77
59
|
store,
|
|
78
60
|
(fPath: string, value: unknown) =>
|
|
@@ -107,15 +89,22 @@ export default abstract class Testeranto<
|
|
|
107
89
|
} as any,
|
|
108
90
|
|
|
109
91
|
class Given extends BaseGiven<ITestShape> {
|
|
110
|
-
|
|
92
|
+
uberCatcher = uberCatcher;
|
|
93
|
+
|
|
94
|
+
async givenThat(
|
|
95
|
+
subject,
|
|
96
|
+
testResource,
|
|
97
|
+
artifactory,
|
|
98
|
+
initializer,
|
|
99
|
+
initialValues,
|
|
100
|
+
pm
|
|
101
|
+
) {
|
|
111
102
|
return fullTestInterface.beforeEach(
|
|
112
103
|
subject,
|
|
113
104
|
initializer,
|
|
114
|
-
|
|
115
|
-
// // TODO does not work?
|
|
116
|
-
// artifactory(`beforeEach/${fPath}`, value),
|
|
105
|
+
artifactory,
|
|
117
106
|
testResource,
|
|
118
|
-
|
|
107
|
+
initialValues,
|
|
119
108
|
pm
|
|
120
109
|
);
|
|
121
110
|
}
|
|
@@ -258,11 +247,10 @@ export default abstract class Testeranto<
|
|
|
258
247
|
} as any,
|
|
259
248
|
|
|
260
249
|
testResourceRequirement
|
|
261
|
-
// puppetMaster
|
|
262
250
|
);
|
|
263
251
|
}
|
|
264
252
|
|
|
265
253
|
abstract receiveTestResourceConfig(
|
|
266
254
|
partialTestResource: string
|
|
267
|
-
): Promise<
|
|
255
|
+
): Promise<IFinalResults>;
|
|
268
256
|
}
|
package/src/lib/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IBaseTest } from "../Types";
|
|
1
|
+
// import { IBaseTest } from "../Types";
|
|
2
2
|
|
|
3
3
|
import type { Plugin } from "esbuild";
|
|
4
4
|
import {
|
|
@@ -9,8 +9,9 @@ import {
|
|
|
9
9
|
BaseWhen,
|
|
10
10
|
BaseThen,
|
|
11
11
|
} from "./abstractBase";
|
|
12
|
-
import {
|
|
13
|
-
|
|
12
|
+
import { IBaseTest } from "../Types";
|
|
13
|
+
|
|
14
|
+
export type IFinalResults = { features: string[]; failed: number };
|
|
14
15
|
|
|
15
16
|
export type IRunTime = `node` | `web`;
|
|
16
17
|
|
|
@@ -28,6 +29,7 @@ export type IPlugin = (
|
|
|
28
29
|
) => Plugin;
|
|
29
30
|
|
|
30
31
|
export type IBaseConfig = {
|
|
32
|
+
src: string;
|
|
31
33
|
clearScreen: boolean;
|
|
32
34
|
debugger: boolean;
|
|
33
35
|
devMode: boolean;
|
|
@@ -46,180 +48,6 @@ export type IBaseConfig = {
|
|
|
46
48
|
|
|
47
49
|
export type IBuiltConfig = { buildDir: string } & IBaseConfig;
|
|
48
50
|
|
|
49
|
-
export type IWebTestInterface<
|
|
50
|
-
ITestShape extends IBaseTest<
|
|
51
|
-
unknown,
|
|
52
|
-
unknown,
|
|
53
|
-
unknown,
|
|
54
|
-
unknown,
|
|
55
|
-
unknown,
|
|
56
|
-
unknown,
|
|
57
|
-
unknown,
|
|
58
|
-
Record<string, any>,
|
|
59
|
-
Record<string, any>,
|
|
60
|
-
Record<string, any>,
|
|
61
|
-
Record<string, any>,
|
|
62
|
-
Record<string, any>
|
|
63
|
-
>
|
|
64
|
-
> = {
|
|
65
|
-
assertThis: (x: ITestShape["then"]) => void;
|
|
66
|
-
|
|
67
|
-
andWhen: (
|
|
68
|
-
store: ITestShape["istore"],
|
|
69
|
-
whenCB: ITestShape["when"],
|
|
70
|
-
testResource: ITTestResourceConfiguration,
|
|
71
|
-
utils: PM
|
|
72
|
-
) => Promise<ITestShape["istore"]>;
|
|
73
|
-
butThen: (
|
|
74
|
-
store: ITestShape["istore"],
|
|
75
|
-
thenCB,
|
|
76
|
-
testResource: ITTestResourceConfiguration,
|
|
77
|
-
utils: PM
|
|
78
|
-
) => Promise<ITestShape["iselection"]>;
|
|
79
|
-
|
|
80
|
-
afterAll: (
|
|
81
|
-
store: ITestShape["istore"],
|
|
82
|
-
artificer: ITestArtificer,
|
|
83
|
-
utils: PM
|
|
84
|
-
) => any;
|
|
85
|
-
afterEach: (
|
|
86
|
-
store: ITestShape["istore"],
|
|
87
|
-
key: string,
|
|
88
|
-
artificer: ITestArtificer,
|
|
89
|
-
utils: PM
|
|
90
|
-
) => Promise<unknown>;
|
|
91
|
-
beforeAll: (
|
|
92
|
-
input: ITestShape["iinput"],
|
|
93
|
-
testResource: ITTestResourceConfiguration,
|
|
94
|
-
artificer: ITestArtificer,
|
|
95
|
-
utils: PM
|
|
96
|
-
) => Promise<ITestShape["isubject"]>;
|
|
97
|
-
beforeEach: (
|
|
98
|
-
subject: ITestShape["isubject"],
|
|
99
|
-
initializer: (c?) => ITestShape["given"],
|
|
100
|
-
artificer: ITestArtificer,
|
|
101
|
-
testResource: ITTestResourceConfiguration,
|
|
102
|
-
initialValues,
|
|
103
|
-
utils: PM
|
|
104
|
-
) => Promise<ITestShape["istore"]>;
|
|
105
|
-
};
|
|
106
|
-
// & ITestInterface<ITestShape>;
|
|
107
|
-
|
|
108
|
-
export type INodeTestInterface<
|
|
109
|
-
ITestShape extends IBaseTest<
|
|
110
|
-
unknown,
|
|
111
|
-
unknown,
|
|
112
|
-
unknown,
|
|
113
|
-
unknown,
|
|
114
|
-
unknown,
|
|
115
|
-
unknown,
|
|
116
|
-
unknown,
|
|
117
|
-
Record<string, any>,
|
|
118
|
-
Record<string, any>,
|
|
119
|
-
Record<string, any>,
|
|
120
|
-
Record<string, any>,
|
|
121
|
-
Record<string, any>
|
|
122
|
-
>
|
|
123
|
-
> = {
|
|
124
|
-
assertThis: (x: ITestShape["then"]) => void;
|
|
125
|
-
andWhen: (
|
|
126
|
-
store: ITestShape["istore"],
|
|
127
|
-
whenCB: ITestShape["when"],
|
|
128
|
-
testResource: ITTestResourceConfiguration,
|
|
129
|
-
utils: PM
|
|
130
|
-
) => Promise<ITestShape["istore"]>;
|
|
131
|
-
butThen: (
|
|
132
|
-
store: ITestShape["istore"],
|
|
133
|
-
thenCB,
|
|
134
|
-
testResource: ITTestResourceConfiguration,
|
|
135
|
-
utils: PM
|
|
136
|
-
) => Promise<ITestShape["iselection"]>;
|
|
137
|
-
afterAll: (
|
|
138
|
-
store: ITestShape["istore"],
|
|
139
|
-
artificer: ITestArtificer,
|
|
140
|
-
pm: PM
|
|
141
|
-
) => any;
|
|
142
|
-
afterEach: (
|
|
143
|
-
store: ITestShape["istore"],
|
|
144
|
-
key: string,
|
|
145
|
-
artificer: ITestArtificer,
|
|
146
|
-
pm: PM
|
|
147
|
-
) => Promise<unknown>;
|
|
148
|
-
beforeAll: (
|
|
149
|
-
input: ITestShape["iinput"],
|
|
150
|
-
testResource: ITTestResourceConfiguration,
|
|
151
|
-
artificer: ITestArtificer,
|
|
152
|
-
pm: PM
|
|
153
|
-
) => Promise<ITestShape["isubject"]>;
|
|
154
|
-
beforeEach: (
|
|
155
|
-
subject: ITestShape["isubject"],
|
|
156
|
-
initializer: (c?) => ITestShape["given"],
|
|
157
|
-
artificer: ITestArtificer,
|
|
158
|
-
testResource: ITTestResourceConfiguration,
|
|
159
|
-
initialValues,
|
|
160
|
-
pm: PM
|
|
161
|
-
) => Promise<ITestShape["istore"]>;
|
|
162
|
-
};
|
|
163
|
-
// & ITestInterface<ITestShape>;
|
|
164
|
-
|
|
165
|
-
export type ITestInterface<
|
|
166
|
-
ITestShape extends IBaseTest<
|
|
167
|
-
unknown,
|
|
168
|
-
unknown,
|
|
169
|
-
unknown,
|
|
170
|
-
unknown,
|
|
171
|
-
unknown,
|
|
172
|
-
unknown,
|
|
173
|
-
unknown,
|
|
174
|
-
Record<string, any>,
|
|
175
|
-
Record<string, any>,
|
|
176
|
-
Record<string, any>,
|
|
177
|
-
Record<string, any>,
|
|
178
|
-
Record<string, any>
|
|
179
|
-
>
|
|
180
|
-
> = {
|
|
181
|
-
assertThis: (x: ITestShape["then"]) => void;
|
|
182
|
-
|
|
183
|
-
andWhen: (
|
|
184
|
-
store: ITestShape["istore"],
|
|
185
|
-
whenCB: ITestShape["when"],
|
|
186
|
-
testResource: ITTestResourceConfiguration,
|
|
187
|
-
pm: PM
|
|
188
|
-
) => Promise<ITestShape["istore"]>;
|
|
189
|
-
butThen: (
|
|
190
|
-
store: ITestShape["istore"],
|
|
191
|
-
thenCB,
|
|
192
|
-
testResource: ITTestResourceConfiguration,
|
|
193
|
-
pm: PM
|
|
194
|
-
) => Promise<ITestShape["iselection"]>;
|
|
195
|
-
|
|
196
|
-
afterAll: (
|
|
197
|
-
store: ITestShape["istore"],
|
|
198
|
-
artificer: ITestArtificer,
|
|
199
|
-
pm: PM
|
|
200
|
-
) => any;
|
|
201
|
-
afterEach: (
|
|
202
|
-
store: ITestShape["istore"],
|
|
203
|
-
key: string,
|
|
204
|
-
artificer: ITestArtificer,
|
|
205
|
-
pm: PM
|
|
206
|
-
) => Promise<unknown>;
|
|
207
|
-
beforeAll: (
|
|
208
|
-
input: ITestShape["iinput"],
|
|
209
|
-
testResource: ITTestResourceConfiguration,
|
|
210
|
-
artificer: ITestArtificer,
|
|
211
|
-
pm: PM
|
|
212
|
-
) => Promise<ITestShape["isubject"]>;
|
|
213
|
-
beforeEach: (
|
|
214
|
-
subject: ITestShape["isubject"],
|
|
215
|
-
initializer: (c?) => ITestShape["given"],
|
|
216
|
-
// artificer: ITestArtificer,
|
|
217
|
-
testResource: ITTestResourceConfiguration,
|
|
218
|
-
initialValues,
|
|
219
|
-
pm: PM
|
|
220
|
-
) => Promise<ITestShape["istore"]>;
|
|
221
|
-
};
|
|
222
|
-
|
|
223
51
|
export type ISuiteKlasser<
|
|
224
52
|
ITestShape extends IBaseTest<
|
|
225
53
|
unknown,
|
package/dist/common/src/Aider.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
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
|
-
exports.execCommand = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const child_process_1 = require("child_process");
|
|
9
|
-
const execCommand = async (command) => {
|
|
10
|
-
const ls = (0, child_process_1.spawn)(command.split(" ")[0], command.split(" ").slice(1, -1));
|
|
11
|
-
process.stdin.pipe(ls.stdin);
|
|
12
|
-
ls.stdout.pipe(process.stdout);
|
|
13
|
-
ls.stderr.pipe(process.stdout);
|
|
14
|
-
// ls.stdout.on("data", function (data) {
|
|
15
|
-
// console.log("stdout: " + data.toString());
|
|
16
|
-
// });
|
|
17
|
-
// ls.stderr.on("data", function (data) {
|
|
18
|
-
// console.log("stderr: " + data.toString());
|
|
19
|
-
// });
|
|
20
|
-
ls.on("exit", function (code) {
|
|
21
|
-
console.log("child process exited with code " + (code === null || code === void 0 ? void 0 : code.toString()) || -1);
|
|
22
|
-
});
|
|
23
|
-
// return new Promise<void>((resolve, reject) => {
|
|
24
|
-
// const [cmd, ...args] = command.split(" ");
|
|
25
|
-
// const childProcess = spawn(cmd, args);
|
|
26
|
-
// childProcess.stdout.on("data", (data) => {
|
|
27
|
-
// process.stdout.write(data.toString());
|
|
28
|
-
// });
|
|
29
|
-
// childProcess.stderr.on("data", (data) => {
|
|
30
|
-
// process.stderr.write(data.toString());
|
|
31
|
-
// });
|
|
32
|
-
// childProcess.on("error", (error) => {
|
|
33
|
-
// reject(error);
|
|
34
|
-
// });
|
|
35
|
-
// childProcess.on("exit", (code) => {
|
|
36
|
-
// if (code === 0) {
|
|
37
|
-
// resolve();
|
|
38
|
-
// } else {
|
|
39
|
-
// reject(new Error(`Command exited with code ${code}.`));
|
|
40
|
-
// }
|
|
41
|
-
// });
|
|
42
|
-
// });
|
|
43
|
-
};
|
|
44
|
-
exports.execCommand = execCommand;
|
|
45
|
-
const key = process.argv[2];
|
|
46
|
-
console.log(key);
|
|
47
|
-
const exitcode = fs_1.default.readFileSync(`${key}/exitcode`).toString();
|
|
48
|
-
console.log("exitcode", exitcode);
|
|
49
|
-
// if (exitcode != "0") {
|
|
50
|
-
if (exitcode != "0") {
|
|
51
|
-
const inputFiles = JSON.parse(fs_1.default.readFileSync(`${key}/inputFiles.json`).toString());
|
|
52
|
-
inputFiles.push(`${key}/tests.json`);
|
|
53
|
-
// const features = await await Promise.all(
|
|
54
|
-
// Array.from(
|
|
55
|
-
// new Set(
|
|
56
|
-
// JSON.parse(fs.readFileSync(`${key}/tests.json`).toString())
|
|
57
|
-
// .givens.reduce((mm: any[], lm: { features: any[] }) => {
|
|
58
|
-
// mm.push(
|
|
59
|
-
// lm.features.reduce((mm2: any[], lm2: any) => {
|
|
60
|
-
// mm2.push(lm2);
|
|
61
|
-
// return mm2;
|
|
62
|
-
// }, [])
|
|
63
|
-
// );
|
|
64
|
-
// return mm;
|
|
65
|
-
// }, [])
|
|
66
|
-
// .flat()
|
|
67
|
-
// .flat()
|
|
68
|
-
// )
|
|
69
|
-
// ) as string[]
|
|
70
|
-
// );
|
|
71
|
-
// const final = features.reduce((mm, [k, v], ndx) => {
|
|
72
|
-
// mm[k] = v;
|
|
73
|
-
// return mm;
|
|
74
|
-
// }, {});
|
|
75
|
-
// const as = JSON.stringify(final);
|
|
76
|
-
// const scriptCommand = `aider --model deepseek --api-key deepseek=${
|
|
77
|
-
// process.env.DEEPSEEK_KEY
|
|
78
|
-
// } --message "Fix the failing tests" --read ${key}/inputFiles.json ${inputFiles
|
|
79
|
-
// .map((i) => `--file ${i}`)
|
|
80
|
-
// .join(" ")}`;
|
|
81
|
-
const scriptCommand = `aider --message "Fix the failing tests" --model deepseek --api-key deepseek=${process.env.DEEPSEEK_KEY} --file ./${inputFiles.join(" ./")}`;
|
|
82
|
-
console.log("scriptCommand", scriptCommand);
|
|
83
|
-
(0, exports.execCommand)(scriptCommand);
|
|
84
|
-
// fs.writeFile(`./${key}/features.json`, as, () => {
|
|
85
|
-
// inputFiles.push(`./${key}/features.json`);
|
|
86
|
-
// // itermTab(scriptCommand).then(() => console.log("yay"));
|
|
87
|
-
// // const child = spawn("xterm -e", scriptCommand.split(" "), {
|
|
88
|
-
// // detached: true,
|
|
89
|
-
// // stdio: "ignore",
|
|
90
|
-
// // });
|
|
91
|
-
// // runCommandInITerm(scriptCommand);
|
|
92
|
-
// });
|
|
93
|
-
// .reduce(async (mm, feature) => {
|
|
94
|
-
// const req = await octokit.request(
|
|
95
|
-
// `GET /repos/adamwong246/kokomobay-taskman/contents/Task/${feature}.json`,
|
|
96
|
-
// {
|
|
97
|
-
// owner: "adamwong246",
|
|
98
|
-
// repo: "kokomoBay-taskman",
|
|
99
|
-
// path: `Task/${feature}.json`,
|
|
100
|
-
// headers: {
|
|
101
|
-
// "X-GitHub-Api-Version": "2022-11-28",
|
|
102
|
-
// },
|
|
103
|
-
// }
|
|
104
|
-
// );
|
|
105
|
-
// const j = JSON.parse(atob(req.data.content));
|
|
106
|
-
// (await mm).push([
|
|
107
|
-
// feature,
|
|
108
|
-
// JSON.stringify({
|
|
109
|
-
// name: j.name,
|
|
110
|
-
// body: j.body,
|
|
111
|
-
// }),
|
|
112
|
-
// ]);
|
|
113
|
-
// return mm;
|
|
114
|
-
// }, Promise.resolve<[string, string][]>([]))
|
|
115
|
-
// .then((z) => {
|
|
116
|
-
// const final = z.reduce((mm, [k, v], ndx) => {
|
|
117
|
-
// mm[k] = v;
|
|
118
|
-
// return mm;
|
|
119
|
-
// }, {});
|
|
120
|
-
// const as = JSON.stringify(final);
|
|
121
|
-
// fs.writeFile(`./${key}/features.json`, as, () => {
|
|
122
|
-
// inputFiles.push(`./${key}/features.json`);
|
|
123
|
-
// const scriptCommand = `aider --model deepseek --api-key deepseek=${
|
|
124
|
-
// process.env.DEEPSEEK_KEY
|
|
125
|
-
// } --message "Fix the failing tests" ${inputFiles.join(" ")}`;
|
|
126
|
-
// console.log("scriptCommand", scriptCommand);
|
|
127
|
-
// execCommand(scriptCommand);
|
|
128
|
-
// // itermTab(scriptCommand).then(() => console.log("yay"));
|
|
129
|
-
// // const child = spawn("xterm -e", scriptCommand.split(" "), {
|
|
130
|
-
// // detached: true,
|
|
131
|
-
// // stdio: "ignore",
|
|
132
|
-
// // });
|
|
133
|
-
// // runCommandInITerm(scriptCommand);
|
|
134
|
-
// });
|
|
135
|
-
// //
|
|
136
|
-
// });
|
|
137
|
-
// features.then((x) => {
|
|
138
|
-
// console.log("done", x);
|
|
139
|
-
// });
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
console.log("that test is not failing");
|
|
143
|
-
}
|