-
Notifications
You must be signed in to change notification settings - Fork 16
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
Error output stack trace could be more useful #21
Comments
I can't tell for sure without looking at the example code, but can you try setting the env variable |
@spion Same thing with the env var set. Here's some example code: Test: Test('MozQueue Integration', t => {
// test setup
return MozQueue.addUrls(urls)
.then(jobs => Promise.all(map(n => waitForJobToFinish(n), jobs)))
.then(result => t.deepEquals(result, expected, 'should have the correct output'));
}); If I remove the arg Here is the export function waitForJobToFinish (job) {
const jobId = typeof job === 'number' ? job : job.jobId;
return jobTracker.waitForJobToFinish(jobId);
} |
Would you rather I try reproduce this in a test and submit a PR? |
@nathanmarks A standalone test-case would be lovely, a PR with a test case even nicer. But just a standalone example would be quite sufficient, as I can't reproduce the issue. |
Nevermind, I managed to find the issue. This will require a slightly more invasive patch of |
@spion I didn't get a chance to debug yet -- what is the solution? |
The solution would be to send the captured exception to tape. Tape assumes that the error was caused in a sync context and generates a new Error object, capturing its trace. However because the function has already returned this trace is useless. The patch would modify edit: I actually remember encountering this error but I didn't find it critical to fix (the more tape patching we do, the bigger the chances that something will break on an upgrade of tape). The reason why I didn't think it was critical is because the stack trace printed below clearly shows the error. Isn't that the case for you? (not the |
The stack is empty for me, I just get the
|
With a similar example (and
example: var t = require('./blue-tape');
var P = require('bluebird');
function fail(x) {
return x.foo();
}
var items = [1,2,3]
t.test("stack", function() {
return P.resolve(items)
.then(items => Promise.all(items.map(i => fail(i))));
}); Might need a test case to reproduce that issue then (the stack missing) |
@spion Ok, let me see what I can pull together for you |
Had inexplicable issues putting together a simple example. I'm not sure if this helps, but I did dig into Is this because I'm executing my tests with |
@nathanmarks I doubt it, I get the same stack trace with The issue with https://github.com/substack/tape/blob/master/lib/results.js#L156-L165 and is taken from the actual error. edit: Seems like something is emptying the error stack. Wouldn't know how that happens though. My best guess is that something changes the |
@spion You're going to hate me. I was piping my output all this time into https://github.com/scottcorgan/tap-spec and I think this is causing the issue: (from |
The raw output from
|
Ha! So is tap-spec doing that to all |
Any news? |
@spion So many things to debug, too little time... It's on my radar! |
@spion This only happens to the I compared the raw tap output of both tools. After a common prefix,
while
which seems to be passed through untouched by The test were run directly with FWIW, exceptions are reported correctly when piping output to Also see this issue and the issues and PRs linked therein : scottcorgan/tap-spec#53 |
Note: I don't know enough about Bluebird's handling of stack traces to know if what I'm bringing up is unique to my setup or a common problem.
Currently my error output looks like this:
Unfortunately, the error stack trace line there isn't very helpful for me.
But if I catch the error myself at the end of the test and
console.log(err.stack)
, the start of my output looks like this:Which is exactly where the error is.
The text was updated successfully, but these errors were encountered: