1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:48:14 +00:00

LibTest: Provide detailed per-file JSON output with --per-file

This makes test-js style runners dump out output in the same format as
libjs-test262's per-file output.
This commit is contained in:
Ali Mohammad Pur 2022-03-08 07:09:41 +03:30 committed by Linus Groh
parent 3063aedb0c
commit 8b50009e9b
6 changed files with 100 additions and 28 deletions

View file

@ -132,12 +132,13 @@ TESTJS_RUN_FILE_FUNCTION(String const& test_file, JS::Interpreter& interpreter,
}
auto test_result = test_passed ? Test::Result::Pass : Test::Result::Fail;
auto test_path = LexicalPath::relative_path(test_file, Test::JS::g_test_root);
auto duration_ms = Test::get_time_in_ms() - start_time;
return Test::JS::JSFileResult {
LexicalPath::relative_path(test_file, Test::JS::g_test_root),
test_path,
{},
Test::get_time_in_ms() - start_time,
duration_ms,
test_result,
{ Test::Suite { "Parse file", test_result, { { expectation_string, test_result, message } } } }
{ Test::Suite { test_path, "Parse file", test_result, { { expectation_string, test_result, message, static_cast<u64>(duration_ms) * 1000u } } } }
};
}