Page MenuHomePhabricator

Add a `KarmaTestEngine`
AbandonedPublic

Authored by joshuaspence on Jul 22 2014, 2:57 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 13, 11:37 AM
Unknown Object (File)
Sat, Apr 13, 11:01 AM
Unknown Object (File)
Sat, Apr 13, 9:42 AM
Unknown Object (File)
Thu, Apr 11, 10:04 AM
Unknown Object (File)
Thu, Apr 11, 1:53 AM
Unknown Object (File)
Tue, Apr 9, 3:22 PM
Unknown Object (File)
Fri, Mar 29, 9:23 PM
Unknown Object (File)
Mar 13 2024, 12:52 PM
Tokens
"Love" token, awarded by tycho.tatitscheff.

Details

Reviewers
epriestley
Group Reviewers
Blessed Reviewers
Summary

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 https://github.com/pc035860/angular-easyfb.git and setup a basic .arcconfig. Ran arc unit.

Diff Detail

Repository
rARC Arcanist
Branch
karma
Lint
Lint Passed
Unit
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.
src/unit/engine/KarmaTestEngine.php
67

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));
src/unit/engine/KarmaTestEngine.php
60–61

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.