Skip to content

t.error swallows errors  #33

@mixmix

Description

@mixmix

t.error is a nice helper which is useful for testing there were no errors. It passes when err == null

// try to do something which creates an error:
const err = new Error('Error creating profile')

// test that there was no error (the expected result)
t.error(err, 'created profile')

The output of this is particularly weak in this module, to the point it forces me to use another printer, or turn the printer off to see what the error was:

tap output

not ok 1 created profile
  ---
    operator: error
    at: Test.<anonymous> (/home/mixmix/projects/SSBC/ssb-tribes2/poop.js:8:5)
    stack: |-
      Error: Error creating profile
          at Test.<anonymous> (/home/mixmix/projects/SSBC/ssb-tribes2/poop.js:5:15)
          at Test.bound [as _cb] (/home/mixmix/projects/SSBC/ssb-tribes2/node_modules/tape/lib/test.js:95:17)
          at Test.run (/home/mixmix/projects/SSBC/ssb-tribes2/node_modules/tape/lib/test.js:115:28)
          at Test.bound [as run] (/home/mixmix/projects/SSBC/ssb-tribes2/node_modules/tape/lib/test.js:95:17)
          at Immediate.next [as _onImmediate] (/home/mixmix/projects/SSBC/ssb-tribes2/node_modules/tape/lib/results.js:157:7)
          at process.processImmediate (node:internal/timers:476:21)
  ...

tap-arc output

    ✖ 1) created profile
      Expected error to be falsy
      At: Test.<anonymous> (/example.js:8:5)

tap-spec ouput

    ✖ created profile
    ------------------
      operator: error
      at: Test.<anonymous> (/home/mixmix/projects/SSBC/ssb-tribes2/poop.js:8:5)
      stack: |-
  Error: Error creating profile
  at Test.<anonymous> (/home/mixmix/projects/SSBC/ssb-tribes2/poop.js:5:15)
  at Test.bound [as _cb] (/home/mixmix/projects/SSBC/ssb-tribes2/node_modules/tape/lib/test.js:95:17)
  at Test.run (/home/mixmix/projects/SSBC/ssb-tribes2/node_modules/tape/lib/test.js:115:28)
  at Test.bound [as run] (/home/mixmix/projects/SSBC/ssb-tribes2/node_modules/tape/lib/test.js:95:17)
  at Immediate.next [as _onImmediate] (/home/mixmix/projects/SSBC/ssb-tribes2/node_modules/tape/lib/results.js:157:7)
  at process.processImmediate (node:internal/timers:476:21)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions