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

feat: run apex tests using the library #2828

Merged
merged 10 commits into from
Jan 6, 2021
Merged

feat: run apex tests using the library #2828

merged 10 commits into from
Jan 6, 2021

Conversation

AnanyaJha
Copy link
Collaborator

@AnanyaJha AnanyaJha commented Dec 21, 2020

What does this PR do?

This PR adds the ability to run apex tests from the sidebar, code lens, and command palette using the Apex library

What issues does this PR fix or reference?

@W-7561367@

@codecov
Copy link

codecov bot commented Dec 21, 2020

Codecov Report

Merging #2828 (37501a4) into develop (53329af) will increase coverage by 0.12%.
The diff coverage is 82.05%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2828      +/-   ##
===========================================
+ Coverage    76.03%   76.15%   +0.12%     
===========================================
  Files          274      273       -1     
  Lines        10388    10453      +65     
  Branches      1185     1197      +12     
===========================================
+ Hits          7898     7961      +63     
+ Misses        2155     2151       -4     
- Partials       335      341       +6     
Impacted Files Coverage Δ
...sforcedx-vscode-apex/src/codecoverage/colorizer.ts 72.50% <66.66%> (-3.56%) ⬇️
...rcedx-vscode-apex/src/views/testOutlineProvider.ts 65.16% <81.48%> (+2.04%) ⬆️
...de-apex/src/commands/forceApexTestRunCodeAction.ts 84.09% <88.23%> (+19.09%) ⬆️
...rcedx-vscode-core/src/commands/forceApexTestRun.ts 90.36% <88.46%> (+2.43%) ⬆️
...s/salesforcedx-vscode-apex/src/views/testRunner.ts 70.83% <100.00%> (ø)
...orcedx-vscode-core/src/commands/forceApexLogGet.ts 44.56% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 53329af...37501a4. Read the comment docs.

@@ -23,21 +25,81 @@ const SfdxCommandlet = sfdxCoreExports.SfdxCommandlet;
const SfdxWorkspaceChecker = sfdxCoreExports.SfdxWorkspaceChecker;
const SfdxCommandletExecutor = sfdxCoreExports.SfdxCommandletExecutor;
const notificationService = sfdxCoreExports.notificationService;
const LibraryCommandletExecutor = sfdxCoreExports.LibraryCommandletExecutor;
const channelService = sfdxCoreExports.channelService;
Copy link
Collaborator Author

@AnanyaJha AnanyaJha Dec 21, 2020

Choose a reason for hiding this comment

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

Since the LibraryCommandletExecutor currently lives in the core package, it uses the default Salesforce CLI channel from the channel services. If we switch to using the new channelService we have in the utils package right now, the experience is wonky because the Starting command.../Ending command... text appears in the default Salesforce CLI channel, while the output from the test run appears in the new channel that we've created. And since the command palette portion of the test:run functionality still lives in the core package as well, all the output from that command is displayed via the Salesforce CLI channel too

In a follow up PR, I think we should migrate the LibraryCommandletExecutor to the utils package, the Apex commands (test:run command) to the apex extension, and then switch this command to use the new channelService so it doesn't cause customers any confusion on which channel they should be looking at for apex test results

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that is part of the work we'll be doing in January to address some perf issues in the Apex extension.

channelService.appendLine(humanOutput);
return true;
}
}

// build force:apex:test:run w/ given test class or test method
export class ForceApexTestRunCodeActionExecutor extends SfdxCommandletExecutor<{}> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

reworked this executor a bit so that it could be used for the sidebar as well

@AnanyaJha AnanyaJha marked this pull request as ready for review December 22, 2020 08:43
@AnanyaJha AnanyaJha requested a review from a team as a code owner December 22, 2020 08:43
@AnanyaJha AnanyaJha force-pushed the aj/testRun branch 2 times, most recently from 8be5745 to 52af314 Compare January 5, 2021 22:25
@AnanyaJha AnanyaJha requested review from lcampos and a team January 5, 2021 22:44
Copy link
Contributor

@brpowell brpowell left a comment

Choose a reason for hiding this comment

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

Ran through the various avenues for running tests with and without code coverage, library setting on and off:

  • test sidebar
  • codelens
  • command palette

Looks good

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