Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

chore(launcher): reorganize launcher #1485

Closed
wants to merge 4 commits into from

Conversation

hankduan
Copy link
Contributor

---experimental---
(motivated by #1449)
After months of commits/changes to runner and launcher code, I think it needs a little clean up. This change has no feature changes or significant output changes.

motivation:

  1. BEFORE: running single test vs forked (sharded/multibrowser) use completely different code paths in terms of error handling, what runner returns, adding listeners, etc, leading to issues like fix(launcher): exit code is always 100 for sharded and 1 for nonsharded ... #1448. Furthermore, at the current state, it means that whenever we need to process the output (i.e. store test output into json file), we need to write different logic to deal with the 2 paths.
    NOW: launcher always calls runnerfork with a parameter to fork or not. runnerfork.run() always returns a promise with results of the run, and reject on errors

  2. BEFORE: Some files contains multiple not-very-related classes that are growing pretty big (i.e. launcher contains reporter, launcher, runnerfork). Moreover, these classes are mutating shared variables and these classes would undoubtedly become more intertwined in the future, leading to future problems
    NOW: broke launcher into launcher, logger, runnerfork

  3. BEFORE: It is difficult to add additional processing to test outputs because 1) jasmine/mocha/cucumber report test results in different ways and 2) runner doesn't expose key test outputs like which specs failed, timing, error message, etc.
    NOW: jasmine/mocha/cucumber consolidate run result into a uniformed form, which runnerfork returns after it finishes running the test.

@hankduan
Copy link
Contributor Author

hey @juliemr can you review when you get a chance? It's pretty experimental so feel free to say the current way of doing launcher/runner is good and leave it alone, or just grab some pieces that you like from this huge PR.

@juliemr juliemr added cla: yes and removed cla: no labels Oct 31, 2014
* start a new process that calls on '/runFromLauncher.js'.
*
* @constructor
* @param {object} task Task to run.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add param annotations for the other parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't change any comments yet. I'll do that as a next iteration, but I just want to see if you like the general feel of the refactor or you think it's excessive.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha - will keep my feedback on that level then.

@juliemr
Copy link
Member

juliemr commented Nov 5, 2014

I think these are all good changes - let's update the comments and docs.

@@ -50,6 +50,7 @@ var optimist = require('optimist').
describe('stackTrace', 'Print stack trace on error').
describe('params', 'Param object to be passed to the tests').
describe('framework', 'Test framework to use: jasmine, cucumber or mocha').
describe('testResultOutput', 'Path to save JSON test result').
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to add to docs/referenceConf - also, I'm not sure about this name. What about resultJsonOutputFile?

@hankduan
Copy link
Contributor Author

hankduan commented Nov 5, 2014

Alright, in that case, I'll finalize the changes tomorrow with:
comments
docs
looking at jsreporter format
rename option to 'resultJsonOutputFile'
and some minor stuff.

Thanks for the review!

@hankduan
Copy link
Contributor Author

hankduan commented Nov 6, 2014

Fixed comments, docs, etc.
However, I can't find the jsreporter format, so that part is not modified yet.

@juliemr juliemr mentioned this pull request Nov 6, 2014
@juliemr
Copy link
Member

juliemr commented Nov 6, 2014

LGTM

@hankduan
Copy link
Contributor Author

hankduan commented Nov 6, 2014

@juliemr I just got cucumber to work too. Can you review that file too before I submit?

// Add a listener into cucumber so that protractor can find out which
// steps passed/failed
var addResultListener = function(formatter) {
var handleStepResultEvent = formatter.handleStepResultEvent;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for clarify, can you rename to 'originalHandleStepResultEvent'?

@juliemr
Copy link
Member

juliemr commented Nov 6, 2014

Couple style nits, then LGTM

@hankduan
Copy link
Contributor Author

hankduan commented Nov 7, 2014

merged in 55a91ea

@hankduan hankduan closed this Nov 7, 2014
@hankduan hankduan deleted the refactorLauncher branch November 26, 2014 21:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants