Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

t.error swallows errors #33

Open
mixmix opened this issue May 24, 2023 · 0 comments
Open

t.error swallows errors #33

mixmix opened this issue May 24, 2023 · 0 comments

Comments

@mixmix
Copy link
Contributor

mixmix commented May 24, 2023

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant