Skip to content

Commit 710be56

Browse files
authored
Hotfix for "Error: undefined" in test output (#20)
* Hacky solution for "error: undefined" * Clean up
1 parent 90f09d2 commit 710be56

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/framework/Reporter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export class ScenarioResult {
8282
public results: Result[] = [];
8383
public error?: Error;
8484

85+
8586
constructor(test: TestScenario, testee: Testee) {
8687
this.test = test;
8788
this.testee = testee;

src/framework/Testee.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,16 @@ export class Testee { // TODO unified with testbed interface
159159
} catch (e) {
160160
await testee.initialize(description.program, description.args ?? []).catch((o) => Promise.reject(o));
161161
}
162-
}).catch((e: Error) => {
163-
scenarioResult.error = e;
162+
}).catch((e: Error|string) => {
163+
if(typeof e === 'string') scenarioResult.error = new Error(e);
164+
else scenarioResult.error = e;
164165
});
165166

166167
await this.run('Get source mapping', testee.connector.timeout, async function () {
167168
map = await testee.mapper.map(description.program);
168-
}).catch((e: Error) => {
169-
scenarioResult.error = e;
169+
}).catch((e: Error|string) => {
170+
if(typeof e === 'string') scenarioResult.error = new Error(e);
171+
else scenarioResult.error = e;
170172
});
171173

172174
if (scenarioResult.error) {

0 commit comments

Comments
 (0)