scottcorgan / tap-out

A different tap parser
MIT License
23 stars 28 forks source link

Fix parsing the error message output by ava --tap #53

Open revir opened 1 year ago

revir commented 1 year ago

This is a patch to fix parsing the failed test output by our AVA test runner with --tap.
The command we used is like this: ava integration_tests/ava_*.js --tap | tap-tc

tap-tc is this lib: https://github.com/zacanger/tap-tc

The returned result is like this:

TAP version 13
# before hook
ok 1 - be able HTTP get /ping
not ok 2 - get one item
  ---
    name: AssertionError
    message: Rejected promise returned by test
    values:
      'Rejected promise returned by test. Reason:': |-
        Error {
          message: 'expected 200 "OK", got 301 "Moved Permanently"',
        }
    at: >-
      integration_tests/ava_apiV3Tests.js:116:4

      ----

      Test._assertStatus (node_modules/supertest/lib/test.js:304:12)

      node_modules/supertest/lib/test.js:80:15

      Test._assertFunction (node_modules/supertest/lib/test.js:338:11)

      Test.assert (node_modules/supertest/lib/test.js:209:21)

      localAssert (node_modules/supertest/lib/test.js:167:12)

      fn (node_modules/supertest/lib/test.js:164:5)

      Test.callback
      (node_modules/supertest/node_modules/superagent/src/node/index.js:902:3)

      IncomingMessage.<anonymous>
      (node_modules/supertest/node_modules/superagent/src/node/index.js:1130:18)
  ...
# after.always hook

1..2
# tests 2
# pass 1
# fail 1