mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:28:12 +00:00
test-js: Display messages from console.log in test output
This will help greatly with debugging!
This commit is contained in:
parent
474159277f
commit
a2dbd955f2
2 changed files with 51 additions and 14 deletions
|
@ -6,6 +6,9 @@ let expect;
|
|||
// name to avoid name collision.
|
||||
let __TestResults__ = {};
|
||||
|
||||
// So test names like "toString" don't automatically produce an error
|
||||
Object.setPrototypeOf(__TestResults__, null);
|
||||
|
||||
// This array is used to communicate with the C++ program. It treats
|
||||
// each message in this array as a separate message. Has a terrible
|
||||
// name to avoid name collision.
|
||||
|
@ -430,8 +433,12 @@ test = (message, callback) => {
|
|||
__TestResults__[suiteMessage] = {};
|
||||
|
||||
const suite = __TestResults__[suiteMessage];
|
||||
if (suite[message])
|
||||
throw new Error("Duplicate test name: " + message);
|
||||
if (suite[message]) {
|
||||
suite[message] = {
|
||||
result: "fail"
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
callback();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue