Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modifications to mocha.js and some TestExecutor logic #1334

Merged
merged 25 commits into from
Oct 14, 2016
Merged

Conversation

ozyx
Copy link
Contributor

@ozyx ozyx commented Oct 12, 2016

Hi again.
This is kind of a big, messy PR but I'd like to get your feedback on the changes before I continue further. I've moved the logic for determining test pass/failure and sending results to mocha.js. It is much easier to determine if we are using mocha API's runner events. This works really nicely if we are running mocha tests, but my main concern is how to make run_tests work among all frameworks with this new logic. I'd like your feedback on these changes and if they are viable.

I've also changed some logic in TestExecutor. The code is currently in a working state, so only running one test per node process, but I've moved much of the setup logic to RunTests, and eventually launching/disposing the process logic will be moved there, as well. I've added some comments with my thought process-- if you need more info I can elaborate.

My biggest concern would be making run_tests work among all testing frameworks, any info on how I can make this work would be greatly appreciated. Using mocha's runner events is really great because I would be able to determine pass/fail easily, record start and end times and include much more data in the result than was available before. If tape and ExportRunner don't have a similar feature (I am unfamiliar with these frameworks) then I'm not sure how viable these changes will be.

Either way, when you have time to review I'd love to hear your opinion.
Thanks!

@msftclas
Copy link

Hi @ozyx, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

Copy link
Contributor

@mjbvz mjbvz left a comment

Choose a reason for hiding this comment

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

I think the approach looks good overall.

To help support the other test framework, you may want to have run_tests for each framework return a result object, and let run_test.js handle actual communication with NTVS. Then just update the other test implementations to return a result object instead of logging their results. Tape should provide an API that is somewhat similar to Mocha, while the export runner is simple enough that it shouldn't be too challenging (it just invokes a test function and catches any error). Did you have any specific concerns with the current approach?

Other than that, just a few minor comments and suggestions. I can merge this in to the working branch as is or you can submit another update to the change before the merge. Let me know either way

@@ -244,6 +354,52 @@ select connection.LocalEndPoint.Port
return projSettings;
}

private static string GetArguments(IEnumerable<string> arguments, bool quoteArgs) {
Copy link
Contributor

Choose a reason for hiding this comment

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

For these, instead of duplicating the code, just mark them as public static in ProcessOutput. They really should be extracted to their own helper class, but just making them accessible is fine for now.

function hook_stdout(callback) {
var old_write = process.stdout.write;

process.stdout.write = (function (write) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just use process.stdout.write = callback here

@@ -100,7 +162,8 @@ class TestExecutor : ITestExecutor {

try {
RunTestCase(app, frameworkHandle, runContext, test, sourceToSettings);
} catch (Exception ex) {
}
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] Keep these on the same line for formatting consistency. Same in other locations.

frameworkHandle.SendMessage(TestMessageLevel.Error, "Error occurred connecting to debuggee.");
KillNodeProcess();
}
} catch (COMException) {
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] Looks like some weird indentation was added here

@ozyx
Copy link
Contributor Author

ozyx commented Oct 14, 2016

Made the appropriate fixes as per your feedback and this PR should be good to merge now.

@mjbvz mjbvz merged commit 97a5d9e into microsoft:test-adapter-improvements Oct 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants