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

LibTest: Add --json flag to JS test runner

This will not show the colorful human-readable file results and final
test results summary but instead output a JSON blob containing all test
information, which can then be processed by other programs easily.
This commit is contained in:
Linus Groh 2021-06-04 08:32:43 +01:00
parent 6c3d601e87
commit 1828607606
2 changed files with 40 additions and 4 deletions

View file

@ -80,6 +80,7 @@ int main(int argc, char** argv)
#else
false;
#endif
bool print_json = false;
const char* specified_test_root = nullptr;
String common_path;
@ -100,6 +101,7 @@ int main(int argc, char** argv)
return true;
},
});
args_parser.add_option(print_json, "Show results as JSON", "json", 'j');
args_parser.add_option(g_collect_on_every_allocation, "Collect garbage after every allocation", "collect-often", 'g');
args_parser.add_option(g_test_glob, "Only run tests matching the given glob", "filter", 'f', "glob");
for (auto& entry : g_extra_args)
@ -164,7 +166,7 @@ int main(int argc, char** argv)
if (!g_vm)
g_vm = JS::VM::create();
TestRunner test_runner(test_root, common_path, print_times, print_progress);
TestRunner test_runner(test_root, common_path, print_times, print_progress, print_json);
test_runner.run();
g_vm = nullptr;