SFDX_IMPROVED_CODE_COVERAGE breaks tests
Summary
Setting export SFDX_IMPROVED_CODE_COVERAGE=true then running unit tests results in error
Steps To Reproduce:
run these commands
-
export SFDX_IMPROVED_CODE_COVERAGE=true -
sfdx force:apex:test:run -d ~/test-results/mic -r junit -w 45 -c -l RunLocalTests
Expected result
Tests to complete and display results
Actual result
Unhandled rejection ERROR_HTTP_431: <h1>Bad Message 431</h1><pre>reason: Request Header Fields Too Large</pre>
at HttpApi.getError (/usr/local/lib/sfdx/node_modules/jsforce/lib/http-api.js:250:13)
at /usr/local/lib/sfdx/node_modules/jsforce/lib/http-api.js:95:22
at tryCallOne (/usr/local/lib/sfdx/node_modules/promise/lib/core.js:37:12)
at /usr/local/lib/sfdx/node_modules/promise/lib/core.js:123:15
at flush (/usr/local/lib/sfdx/node_modules/asap/raw.js:50:29)
at process._tickCallback (internal/process/next_tick.js:61:11)
ERROR running force:apex:test:run: Cannot read property 'message' of undefined
Additional information
Feel free to attach a screenshot.
SFDX CLI Version(to find the version of the CLI engine run sfdx --version): sfdx-cli/7.50.0-9030e49cbb linux-x64 node-v10.15.3
SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core) @oclif/plugin-autocomplete 0.1.5 (core) @oclif/plugin-commands 1.2.3 (core) @oclif/plugin-help 2.2.3 (core) @oclif/plugin-not-found 1.2.3 (core) @oclif/plugin-plugins 1.7.9 (core) @oclif/plugin-update 1.3.9 (core) @oclif/plugin-warn-if-update-available 1.7.0 (core) @oclif/plugin-which 1.0.3 (core) @salesforce/sfdx-trust 3.0.7 (core) analytics 1.7.1 (core) generator 1.1.2 (core) salesforcedx 48.5.1 (core) ├─ @salesforce/sfdx-plugin-lwc-test 0.1.5 (core) ├─ salesforcedx-templates 48.6.0 (core) └─ salesforce-alm 48.7.0 (core)
sfdx-cli 7.50.0 (core)
OS and version: Kernel Version: Linux c626448367da 4.15.0-1052-aws #54-Ubuntu SMP Tue Oct 1 15:43:26 UTC 2019 x86_64 Linux Starting container circleci/node:12
@yippie, I have asked the team that owns the apex commands to take a look
Is there any progress here? I am still hitting this issue 6 months later.
I am getting the impression the Salesforce dev tools are not tested on projects bigger than a couple dozen classes.
I suggest running the tests asynchronously with test:run command without any parameters just username.
sfdx force:apex:test:run -u <targetusername>
This will return a corresponding test id in suggestion. To generate the test report, run test:report command with parameters(like -c, -d) as per the requirement.
sfdx force:apex:test:report -i <test id:70xx3000011Yxxx> -u <targetusername> -c
Yea, this is happening because you are hitting api limits. The CLI cannot do anything about this.
Try @RitamAgrawal suggestion or take advantage of Test Suites as Shane mentions here: https://github.com/forcedotcom/cli/issues/2409#issuecomment-1727854948