testeranto 0.158.1 → 0.160.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.
@@ -10,11 +10,11 @@ exports.default = async () => {
10
10
  `testeranto/`,
11
11
  `testeranto/bundles/`,
12
12
  `testeranto/bundles/node`,
13
- `testeranto/bundles/pure`,
14
13
  `testeranto/bundles/web`,
15
- `testeranto/externalTests/`,
16
- `testeranto/features/`,
14
+ `testeranto/bundles/pure`,
17
15
  `testeranto/reports/`,
16
+ `testeranto/features/`,
17
+ `testeranto/externalTests/`,
18
18
  ].forEach((f) => {
19
19
  try {
20
20
  fs_1.default.mkdirSync(`${process.cwd()}/${f}`);
@@ -17,19 +17,39 @@ const fetchTestData = async (projectName, filepath, runTime) => {
17
17
  .split(".")
18
18
  .slice(0, -1)
19
19
  .join(".")}/${runTime}`;
20
- const [testRes, logsRes, typeRes, lintRes] = await Promise.all([
21
- fetch(`${basePath}/tests.json`),
22
- fetch(`${basePath}/logs.txt`),
23
- fetch(`${basePath}/type_errors.txt`),
24
- fetch(`${basePath}/lint_errors.txt`),
25
- ]);
26
- return {
27
- // testData: await testRes.json(),
28
- testData: fakeTestJson,
29
- logs: await logsRes.text(),
30
- typeErrors: await typeRes.text(),
31
- lintErrors: await lintRes.text(),
32
- };
20
+ try {
21
+ const [testRes, logsRes, typeRes, lintRes] = await Promise.all([
22
+ fetch(`${basePath}/tests.json`),
23
+ fetch(`${basePath}/logs.txt`),
24
+ fetch(`${basePath}/type_errors.txt`),
25
+ fetch(`${basePath}/lint_errors.txt`),
26
+ ]);
27
+ if (!testRes.ok) {
28
+ return {
29
+ testData: null,
30
+ logs: await logsRes.text(),
31
+ typeErrors: await typeRes.text(),
32
+ lintErrors: await lintRes.text(),
33
+ error: "Tests did not complete successfully. Please check the build and runtime logs for errors."
34
+ };
35
+ }
36
+ return {
37
+ testData: await testRes.json(),
38
+ logs: await logsRes.text(),
39
+ typeErrors: await typeRes.text(),
40
+ lintErrors: await lintRes.text(),
41
+ error: null
42
+ };
43
+ }
44
+ catch (err) {
45
+ return {
46
+ testData: null,
47
+ logs: "",
48
+ typeErrors: "",
49
+ lintErrors: "",
50
+ error: `Failed to load test data: ${err instanceof Error ? err.message : String(err)}`
51
+ };
52
+ }
33
53
  };
34
54
  exports.fetchTestData = fetchTestData;
35
55
  const fetchBuildLogs = async (projectName, runtime) => {
@@ -37,182 +57,3 @@ const fetchBuildLogs = async (projectName, runtime) => {
37
57
  return await res.json();
38
58
  };
39
59
  exports.fetchBuildLogs = fetchBuildLogs;
40
- const fakeTestJson = {
41
- name: "Testing the Rectangle class",
42
- givens: [
43
- {
44
- key: "test0",
45
- name: "Default",
46
- whens: [
47
- {
48
- name: "setWidth: 4",
49
- error: true,
50
- },
51
- {
52
- name: "setHeight: 19",
53
- error: true,
54
- },
55
- ],
56
- thens: [
57
- {
58
- name: "getWidth: 4",
59
- error: false,
60
- },
61
- {
62
- name: "getHeight: 19",
63
- error: false,
64
- },
65
- ],
66
- error: null,
67
- features: [
68
- "https://api.github.com/repos/adamwong246/testeranto/issues/8",
69
- ],
70
- },
71
- {
72
- key: "test1",
73
- name: "Default",
74
- whens: [
75
- {
76
- name: "setWidth: 4",
77
- error: true,
78
- },
79
- {
80
- name: "setHeight: 5",
81
- error: true,
82
- },
83
- ],
84
- thens: [
85
- {
86
- name: "getWidth: 4",
87
- error: false,
88
- },
89
- {
90
- name: "getHeight: 5",
91
- error: false,
92
- },
93
- {
94
- name: "area: 20",
95
- error: false,
96
- },
97
- {
98
- name: "AreaPlusCircumference: 38",
99
- error: false,
100
- },
101
- ],
102
- error: null,
103
- features: ["Rectangles have width and height."],
104
- },
105
- {
106
- key: "test2",
107
- name: "Default",
108
- whens: [
109
- {
110
- name: "setHeight: 4",
111
- error: true,
112
- },
113
- {
114
- name: "setWidth: 33",
115
- error: true,
116
- },
117
- ],
118
- thens: [
119
- {
120
- name: "area: 132",
121
- error: false,
122
- },
123
- ],
124
- error: null,
125
- features: ["Rectangles have area"],
126
- },
127
- {
128
- key: "test2_1",
129
- name: "Default",
130
- whens: [],
131
- thens: [
132
- {
133
- name: "getWidth: 2",
134
- error: false,
135
- },
136
- {
137
- name: "getHeight: 2",
138
- error: false,
139
- },
140
- ],
141
- error: null,
142
- features: ["Rectangles have default size"],
143
- },
144
- {
145
- key: "test3",
146
- name: "Default",
147
- whens: [
148
- {
149
- name: "setHeight: 5",
150
- error: true,
151
- },
152
- {
153
- name: "setWidth: 5",
154
- error: true,
155
- },
156
- ],
157
- thens: [
158
- {
159
- name: "area: 25",
160
- error: false,
161
- },
162
- ],
163
- error: null,
164
- features: [
165
- "file:///Users/adam/Code/testeranto-starter/src/Rectangle/README.md",
166
- ],
167
- },
168
- {
169
- key: "test4",
170
- name: "Default",
171
- whens: [
172
- {
173
- name: "setHeight: 6",
174
- error: true,
175
- },
176
- {
177
- name: "setWidth: 6",
178
- error: true,
179
- },
180
- ],
181
- thens: [
182
- {
183
- name: "area: 36",
184
- error: false,
185
- },
186
- ],
187
- error: null,
188
- features: ["Rectangles have area"],
189
- },
190
- {
191
- key: "test5",
192
- name: "Default",
193
- whens: [],
194
- thens: [
195
- {
196
- name: "getWidth: 2",
197
- error: false,
198
- },
199
- {
200
- name: "getHeight: 2",
201
- error: false,
202
- },
203
- ],
204
- error: null,
205
- features: ["Rectangles have default size, again"],
206
- },
207
- ],
208
- checks: [],
209
- fails: 0,
210
- features: [
211
- "https://api.github.com/repos/adamwong246/testeranto/issues/8",
212
- "Rectangles have width and height.",
213
- "Rectangles have area",
214
- "Rectangles have default size",
215
- "file:///Users/adam/Code/testeranto-starter/src/Rectangle/README.md",
216
- "Rectangles have default size, again",
217
- ],
218
- };