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

Preserve stacktraces for async/await #537

Merged
merged 1 commit into from
Jan 4, 2021
Merged

Conversation

Raynos
Copy link
Collaborator

@Raynos Raynos commented Dec 31, 2020

We use self.ifError(err) instead of self.fail()
which logs the original stacktrace instead of creating
a new Error object.

Fixes #536

lib/test.js Outdated Show resolved Hide resolved
@Raynos
Copy link
Collaborator Author

Raynos commented Jan 2, 2021

Addressed feedback.

test/async-await.js Outdated Show resolved Hide resolved
@ljharb ljharb self-assigned this Jan 2, 2021
@ljharb ljharb force-pushed the rejection-stacktrace branch from d816458 to a2128b1 Compare January 2, 2021 21:44
@Raynos
Copy link
Collaborator Author

Raynos commented Jan 3, 2021

Cleaned up the test, this looks good to merge to me.

@ljharb
Copy link
Collaborator

ljharb commented Jan 3, 2021

I’m going to land #538 first and rebase this, so i can be sure tests pass in all relevant node versions, and then I’ll land this one.

@ljharb ljharb force-pushed the rejection-stacktrace branch from 3c81294 to cb5d7fd Compare January 3, 2021 21:33
@codecov-io
Copy link

codecov-io commented Jan 3, 2021

Codecov Report

Merging #537 (d505cdf) into master (82c3904) will decrease coverage by 0.02%.
The diff coverage is 75.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #537      +/-   ##
==========================================
- Coverage   73.87%   73.84%   -0.03%     
==========================================
  Files          19       19              
  Lines         754      757       +3     
  Branches      145      146       +1     
==========================================
+ Hits          557      559       +2     
- Misses        197      198       +1     
Impacted Files Coverage Δ
lib/test.js 95.97% <75.00%> (-0.28%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 82c3904...d505cdf. Read the comment docs.

@ljharb ljharb force-pushed the rejection-stacktrace branch from cb5d7fd to 3325344 Compare January 3, 2021 21:58
@ljharb
Copy link
Collaborator

ljharb commented Jan 3, 2021

I'll fix these last failing tests, and land this tonight.

@ljharb ljharb force-pushed the rejection-stacktrace branch from 3325344 to d505cdf Compare January 4, 2021 02:19
@ljharb ljharb merged commit d505cdf into master Jan 4, 2021
@ljharb ljharb deleted the rejection-stacktrace branch January 4, 2021 05:38
ljharb added a commit that referenced this pull request Jan 4, 2021
 - [Fix] preserve stack traces for returned Promises (async/await) (#537)
 - [Robustness] cache and call-bind more prototype methods
 - [Refactor] use `call-bind/callBound` instead of `function-bind` directly
 - [readme] Document unexpected `t.end()` behavior (#279)
 - [readme] Added tabe into reporter list (#249)
 - [readme] improve method docs
 - [meta] do not publish github action workflow files
 - [meta] run `aud` in `posttest`
 - [meta] add Automatic Rebase and Require Allow Edits workflows
 - [eslint] ensure no trailing commas
 - [eslint] fix some inconsistencies
 - [Tests] make `stripFullStack` output an array of lines, for better failure messages
 - [Tests] add `npm run test:example` to test non-failing examples.
 - [Tests] migrate tests to Github Actions (#538)
 - [Tests] skip Promise tests when Promises are not available
 - [Tests] run `nyc` on all tests
 - [Tests] add `timeoutAfter` test with Promises
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exceptions throw in test('.', async (t) => { ... }) do not have meaningful stacktrace
3 participants