Page MenuHomePhabricator

Add a `KarmaTestEngine`

Authored by joshuaspence on Jul 22 2014, 2:57 AM.
Referenced Files
Unknown Object (File)
Sun, Aug 14, 8:36 AM
Unknown Object (File)
Sat, Aug 13, 5:49 PM
Unknown Object (File)
Sat, Aug 13, 1:19 PM
Unknown Object (File)
Tue, Aug 2, 9:27 PM
Unknown Object (File)
Thu, Jul 21, 3:54 AM
Unknown Object (File)
Sun, Jul 17, 8:26 AM
Unknown Object (File)
Jul 16 2022, 2:39 PM
Unknown Object (File)
Jul 14 2022, 8:53 PM
"Love" token, awarded by tycho.tatitscheff.


Group Reviewers
Blessed Reviewers

This isn't perfect, but it works okay. Unfortunately, some aspects of karma can't be configured from the command line (they have to be specified in the configuration file, which is JavaScript) which means that this test engine will probably not work unless the project has its Karma configuration file configured properly.

Test Plan

Cloned and setup a basic .arcconfig. Ran arc unit.

Diff Detail

rARC Arcanist
Lint Passed
Tests Passed
Build Status
Buildable 1825
Build 1826: [Placeholder Plan] Wait for 30 Seconds

Event Timeline

joshuaspence retitled this revision from to Add a `KarmaTestEngine`.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.

I'm not sure whether we want this in the upstream yet. I'm putting it here so that a colleague can arc patch it. I think that the unit test engine code needs some cleaning up before we add new engines.

pswai removed a subscriber: pswai.
chengyin added inline comments.

Just in case you want to ever revisit this again, this will read file that is relative to the current working directory instead of the project root directory, and arc diff/unit would only be run-able in the project root directory.

We use

$working_copy = $this->getWorkingCopy();
$project_root = $working_copy->getProjectRoot();
$parser = new ArcanistXUnitTestResultParser();

return $parser->parseTestResults(Filesystem::readFile($project_root . '/' . $junit));

Another note here. Unless I missed something, to run karma in non watch mode, --single-run option will be needed. However, in the single run mode karma will exit with code 1 when the test fails.

This will cause arc to not parse the test result, and since the reporters on karma's option here is only coverage and junit, there will be no test result outputted by karma either, leaving no information about why arc unit / arc diff failed.

I'm not sure whether we want this in the upstream yet.

Can you explain why ? I was about to write a karma / mocha UnitTestEngine and request a review in the upstream thus I'm interrested in understanding why upstream don't need this !

Unit test engines generally are a bit hard to use and configure at the moment. This should eventually be resolved by T5568. More specifically, all test engines will need to be partially refactored for T5568 anyway.