Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14758918
D11690.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D11690.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -184,6 +184,7 @@
'ArcanistTodoWorkflow' => 'workflow/ArcanistTodoWorkflow.php',
'ArcanistUncommittedChangesException' => 'exception/usage/ArcanistUncommittedChangesException.php',
'ArcanistUnitConsoleRenderer' => 'unit/renderer/ArcanistUnitConsoleRenderer.php',
+ 'ArcanistUnitJSONRealtimeRenderer' => 'unit/renderer/ArcanistUnitJSONRealtimeRenderer.php',
'ArcanistUnitRenderer' => 'unit/renderer/ArcanistUnitRenderer.php',
'ArcanistUnitTestEngine' => 'unit/engine/ArcanistUnitTestEngine.php',
'ArcanistUnitTestResult' => 'unit/ArcanistUnitTestResult.php',
@@ -366,6 +367,7 @@
'ArcanistTodoWorkflow' => 'ArcanistWorkflow',
'ArcanistUncommittedChangesException' => 'ArcanistUsageException',
'ArcanistUnitConsoleRenderer' => 'ArcanistUnitRenderer',
+ 'ArcanistUnitJSONRealtimeRenderer' => 'ArcanistUnitRenderer',
'ArcanistUnitTestableLintEngine' => 'ArcanistLintEngine',
'ArcanistUnitWorkflow' => 'ArcanistWorkflow',
'ArcanistUpgradeWorkflow' => 'ArcanistWorkflow',
diff --git a/src/unit/renderer/ArcanistUnitJSONRealtimeRenderer.php b/src/unit/renderer/ArcanistUnitJSONRealtimeRenderer.php
new file mode 100644
--- /dev/null
+++ b/src/unit/renderer/ArcanistUnitJSONRealtimeRenderer.php
@@ -0,0 +1,13 @@
+<?php
+
+final class ArcanistUnitJSONRealtimeRenderer extends ArcanistUnitRenderer {
+
+ public function renderUnitResult(ArcanistUnitTestResult $result) {
+ return '##arc-unit## '.json_encode($result->toDictionary())."\n";
+ }
+
+ public function renderPostponedResult($count) {
+ return null;
+ }
+
+}
diff --git a/src/workflow/ArcanistUnitWorkflow.php b/src/workflow/ArcanistUnitWorkflow.php
--- a/src/workflow/ArcanistUnitWorkflow.php
+++ b/src/workflow/ArcanistUnitWorkflow.php
@@ -75,6 +75,9 @@
'help' =>
"With 'full', show full pretty report (Default). ".
"With 'json', report results in JSON format. ".
+ "With 'json-realtime', report results in JSON format as ".
+ "test results occur (JSON entries separated by newlines ".
+ "and prefixed with '##arc-unit## '). ".
"With 'ugly', use uglier (but more efficient) JSON formatting. ".
"With 'none', don't print results. ",
'conflicts' => array(
@@ -153,7 +156,13 @@
}
$this->engine->setArguments($this->getPassthruArgumentsAsMap('unit'));
- $renderer = new ArcanistUnitConsoleRenderer();
+ $output_format = $this->getOutputFormat();
+
+ if ($output_format === 'json-realtime') {
+ $renderer = new ArcanistUnitJSONRealtimeRenderer();
+ } else {
+ $renderer = new ArcanistUnitConsoleRenderer();
+ }
$this->engine->setRenderer($renderer);
$enable_coverage = null; // Means "default".
@@ -177,9 +186,7 @@
$console = PhutilConsole::getConsole();
- $output_format = $this->getOutputFormat();
-
- if ($output_format !== 'full') {
+ if ($output_format !== 'full' && $output_format !== 'json-realtime') {
$console->disableOut();
}
@@ -268,7 +275,7 @@
}
}
- if ($output_format !== 'full') {
+ if ($output_format !== 'full' && $output_format !== 'json-realtime') {
$console->enableOut();
}
$data = array_values(mpull($results, 'toDictionary'));
@@ -351,6 +358,7 @@
$known_formats = array(
'none' => 'none',
'json' => 'json',
+ 'json-realtime' => 'json-realtime',
'ugly' => 'ugly',
'full' => 'full',
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 23, 10:57 AM (21 h, 12 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7025886
Default Alt Text
D11690.diff (3 KB)
Attached To
Mode
D11690: Allow unit test results to be outputted as JSON in realtime
Attached
Detach File
Event Timeline
Log In to Comment