Skip to content

Commit 0bb38e9

Browse files
show json serialized diff of test and expectations (#100)
* show json serialized diff of test and expectations * bump to 1.3.0
1 parent 3454761 commit 0bb38e9

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

package-testing/sdk-test-runner/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sdk-test-runner",
3-
"version": "1.2.0",
3+
"version": "1.3.0",
44
"description": "Test runner for SDK package testing",
55
"main": "src/app.ts",
66
"repository": "https://github.com/Eppo-exp/sdk-test-data",
@@ -38,4 +38,4 @@
3838
"ts-node": "^10.9.2",
3939
"typescript-eslint": "^8.4.0"
4040
}
41-
}
41+
}

package-testing/sdk-test-runner/src/app.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,16 @@ export default class App {
276276
message: result.error,
277277
});
278278

279-
logIndent(1, red('fail') + ` ${testCaseLabel}: ${result.result} != ${subject.assignment}`);
279+
logIndent(1, red('fail') + ` ${testCaseLabel}: ${result.error}`);
280280
} else if (!App.isResultCorrect(result, subject)) {
281281
testCaseResult.failures ??= [];
282282
testCaseResult.failures.push({
283-
message: `Value ${result.result} did not match expected ${subject.assignment}`,
283+
message: `Value ${JSON.stringify(result.result)} did not match expected ${JSON.stringify(subject.assignment)}`,
284284
});
285285

286-
logIndent(1, red('fail') + ` ${testCaseLabel}: ${result.result} != ${subject.assignment}`);
286+
logIndent(1, red('fail') + ` ${testCaseLabel}:\n` +
287+
` Expected: ${JSON.stringify(subject.assignment, null, 2)}\n` +
288+
` Received: ${JSON.stringify(result.result, null, 2)}`);
287289
} else {
288290
testCaseResult.assertions = 1;
289291

0 commit comments

Comments
 (0)