othiym23 / bug-clinic

a nodeschool.io-style workshopper for learning how to debug Node.js apps
https://npmjs.org/package/bug-clinic
BSD 2-Clause "Simplified" License
175 stars 49 forks source link

stacktraces test 3 does not pass #24

Closed adampaulukanis closed 7 years ago

adampaulukanis commented 7 years ago

Hello, when I try to do: bug-clinic run scenario.js I got:

TAP version 13
# (anonymous)
ok 1 got error
ok 2 found previous stack
not ok 3 found current stack
  ---
    operator: ok
    expected: true
    actual:   null
    at: Domain.<anonymous> (/Users/adam/homebrew/lib/node_modules/bug-clinic/problems/stacktraces/index.js:36:13)
  ...

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

I use (uname -a): Darwin AdamMac.local 16.1.0 Darwin Kernel Version 16.1.0: Wed Oct 19 20:31:56 PDT 2016; root:xnu-3789.21.4~4/RELEASE_X86_64 x86_64.

Sorry about the output, I do not know how to disable markdown here.

adampaulukanis commented 7 years ago

I cannot pass 3rd test. How about changing the test from /Object.parse/ to /JSON.parse/ in problems/stacktraces/index.js?

JasonRammoray commented 7 years ago

Agree with @adam17.

@othiym23, is there a rigorous reason why this lesson expects to see Object.parse in the stacktrace:

t.ok(stack.match(/Object.parse/), "found current stack");

At the moment we have to add an additional string to error.stack (that is really awkward) in order to pass a third unit test:

// Assuming this is a content of error callback, which we are passing to tryCatch as a second argument
error.stack += 'Object.parse';
othiym23 commented 7 years ago

I need to review the PRs for this and do a general scan for bitrot; there's no particular reason for the current tests except that they got the workshopper working when I wrote it. Thanks for the heads up!