How can I upload and view Mocha.js terminal logs on LambdaTest?

How can I upload and view Mocha.js terminal logs on LambdaTest?

Hi Dipen!

Any test/terminal report generated by the testing framework in JSON,XML, txt, or other common format can be uploaded. The uploaded file can then be viewed in the LOGS section of the automation dashboard page. The file should not be larger than 2MB.

You can use LambdaTest API to upload terminal logs.

Here are the below steps to upload and view Mocha.js terminal logs -

  1. Navigate to the LambdaTest API page and click Authorize button to enter your valid LambdaTest credentials to authenticate API requests.

  2. Navigate to the Session section and select the terminal logs POST request.

  3. Enter your session ID and choose the log file to upload (JSON, XML, .txt).

And you are done!

Also you can do this with a CURL command (replace session-id, auth code, and filename)-

curl -X POST "https://api.lambdatest.com/automation/api/v1/sessions/session-id/terminal-logs" -H "accept: application/json" -H "Authorization: Basic aWliMjAxOTAyNDprUlZIV2lQRN0ZDeWpqbDZxNUlzRWo1aA==" -H "Content-Type: multipart/form-data" -F "file=filename"

Please check out the below GitHub repo for uploading and viewing terminal logs for Mocha.js testing

https://github.com/rshmimondal/Mocha-js-terminal-logs