Improve test failure reporting in the Postman app - Show line of code that caused fail


TL; DR - Can we add stacktrace to errors or the line of code that failed?

After writing tests using Mocha/Chai in Node and then coming back to Postman was a huge bummer, primarily debugging was considerably difficult.

Give I’ll get the below response:

   "customer": {
       "customer_id": 21972,
       "customer_number": "TST999",
       "customer_type": "Standard",
       "company_name": "",
       "forename": "Testy",
       "lastname": "McTester",
       "email_address": "",
       "telephone1": "1234",
       "telephone2": "1234",
       "fax": "1234"

If I have the below code in Postman in the Tests tab:

const body = JSON.parse(responseBody);

pm.test("Expects a 200 response code", function() {

pm.test("Checks stuff", function() {
    const customer = body.customer;
    // The below assertion is expected to fail

Postman will output the error

When running the same test in mocha/chai, I’m told which line of code failed:

Is Postman able to tell me which line of code in my ‘Tests’ tab caused the fail?
You could probably argue I should split up my tests up into proper ‘its’ but the issue raised is still valid…