question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

force:apex:test:run --verbose no longer emitting output to stdout

See original GitHub issue

Since upgrading to sfdx-cli version 7.112.0, I am noticing that the following command is no longer outputting command output to stdout:

sfdx force:apex:test:run -w 60 --verbose

Prior to this installing this upgrade, I would see periodic output to stdout indicating the cli was polling for updates, and then at the end of the test run, it would spit out a summary of all of the tests that were run, along with a summary of how many tests passed or failed. The lack of output is particularly problematic in our CI environment, which runs against Scratch Orgs, and then deletes the Scratch Orgs upon completion, so there’s no record of the tests that failed.

Steps To Reproduce:

  1. Execute the command against your Apex code base with unit test classes:

sfdx force:apex:test:run -w 60 --verbose

Expected result

I expect to see periodic progress updates while the tests are running, and a test summary when the test run completes.

Actual result

No output is emitted to stdout either while the tests are running, or once the tests have completed.

System Information

D:\Development\sfptdev.tom>sfdx version --verbose --json
{
        "cliVersion": "sfdx-cli/7.113.0",
        "architecture": "win32-x64",
        "nodeVersion": "node-v14.17.4",
        "pluginVersions": [
                "@oclif/plugin-autocomplete 0.3.0 (core)",
                "@oclif/plugin-commands 1.3.0 (core)",
                "@oclif/plugin-help 3.2.2 (core)",
                "@oclif/plugin-not-found 1.2.4 (core)",
                "@oclif/plugin-plugins 1.10.1 (core)",
                "@oclif/plugin-update 1.4.0-3 (core)",
                "@oclif/plugin-warn-if-update-available 1.7.0 (core)",
                "@oclif/plugin-which 1.0.3 (core)",
                "@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)",
                "@salesforce/sfdx-trust 3.6.0 (core)",
                "alias 1.1.10 (core)",
                "apex 0.2.3 (core)",
                "auth 1.7.1 (core)",
                "config 1.2.23 (core)",
                "custom-metadata 1.0.12 (core)",
                "data 0.6.0 (core)",
                "etcopydata 0.6.4-Beta (beta)",
                "generator 1.1.7 (core)",
                "limits 1.2.1 (core)",
                "org 1.6.9 (core)",
                "salesforce-alm 52.2.4 (core)",
                "schema 1.0.8 (core)",
                "sfdx-cli 7.113.0 (core)",
                "source 1.0.7 (core)",
                "telemetry 1.2.3 (core)",
                "templates 52.1.0 (core)",
                "user 1.4.0 (core)"
        ],
        "osVersion": "Windows_NT 10.0.19042"
}

This also happens in our CI/CD environment, which is based on GitHub Actions running on Ubuntu VMs.

Additional Information

Here is an excerpt of test output generated by an earlier version of sfdx-cli (sorry, I do not know the exact version this was generated by):

test:
     [exec] Using specified username xxxxxxxxxxxxxxxxxxx
     [exec] 
     [exec] Listening for results
     [exec] Invoking Apex tests...
     [exec] Started async test run job: 7071E0000BQ1FGx
     [exec] Processing event for job 7071E0000BQ1FGxQQN
     [exec] Processing event for job 7071E0000BQ1FGxQQN
     .
     .
     .
     [exec] Processing event for job 7071E0000BQ1FGxQQN
     [exec] Processing event for job 7071E0000BQ1FGxQQN
     [exec] Retrieving test results for job 7071E0000BQ1FGx...
     [exec] 
     [exec] === Test Results
     [exec] TEST NAME                                                                                                                                                                                      OUTCOME  MESSAGE  RUNTIME (MS)
     [exec] ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  ───────  ───────  ────────────
     [exec] fflib_AnswerTest.thatAnswerOnlyForTheMethodStubbedWithAnswer                                                                                                                                   Pass              73
     [exec] fflib_AnswerTest.thatAnswerOnlyForTheStubbedParameter                                                                                                                                          Pass              15
     [exec] fflib_AnswerTest.thatAnswersWithException                                                                                                                                                      Pass              13
     .
     .
     .
     [exec] UT_TestDataFactory.requirePersistenceTypeToNotBe_When_actualIsNotTheTypeToExclude_Expect_Success                                                                                               Pass              8
     [exec] UT_TestDataFactory.requirePersistenceType_When_actualDoesNotMatchRequired_Expect_Exception                                                                                                     Pass              10
     [exec] UT_TestDataFactory.requirePersistenceType_When_actualMatchesRequired_Expect_Success                                                                                                            Pass              9
     [exec] 
     [exec] === Test Summary
     [exec] NAME                 VALUE
     [exec] ───────────────────  ─────────────────────────────
     [exec] Outcome              Passed
     [exec] Tests Ran            1722
     [exec] Passing              1722
     [exec] Failing              0
     [exec] Skipped              0
     [exec] Pass Rate            100%
     [exec] Fail Rate            0%
     [exec] Test Start Time      Aug 10, 2021 5:47 PM
     [exec] Test Execution Time  5110078 ms
     [exec] Test Total Time      2112927 ms
     [exec] Command Time         605235 ms
     [exec] Hostname             xxxxxxxxxxxxxxxxx
     [exec] Org Id               xxxxxxxxxxxxxxxxxx
     [exec] Username             xxxxxxxxxxxxxxxxx
     [exec] Test Run Id          7071E0000BQ1FGx
     [exec] User Id              00580000001jihXAAQ
     [exec] 

BUILD SUCCESSFUL
Total time: 10 minutes 9 seconds

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jeffb-sfdccommented, Sep 10, 2021

I’ll take this on.

0reactions
tfudacommented, Oct 15, 2021

I am now seeing the test summary written to the console upon completion without having to add the β€œ-r human” option.

Read more comments on GitHub >

github_iconTop Results From Across the Web

apex Commands | Salesforce CLI Command Reference
force:apex:test:run ... Executes one or more lines of anonymous Apex code entered on the command line, ... Emit additional command output to stdout....
Read more >
How to print from go test to console without using verbose option
I have tried printing from the test using: fmt.Println("my message") // STDOUT; fmt.Fprintln(os.Stderr, "my message")Β ...
Read more >
Getting WGET to display a less verbose output - Super User
You can use -nv or --no-verbose to make wget less verbose, but it won't show download progress in that case.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found