You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do you want to request a feature or report a bug?
Either a bug or a missing feature for resolves and rejects.
What is the current behavior?
When resolves or rejects are used, stack traces only include stack frames internal to expect, Jest, and Node, not the source files that caused the error.
If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can yarn install and yarn test.
Use the expect(...).resolves or .rejects syntax, either returning the expression or using an async function with await before expect. This issue can be avoided by using async functions without resolves/rejects, which I'm currently using as a workaround.
Unhelpful stack trace with resolves/rejects:
test('script with fixed version',async()=>{consturl=`https://unpkg.com/${name}@${version}/index.js`awaitexpect(cdnm.updateDependency(createScript(url))).resolves.toEqual(createScript(replaceVersion(url)))})
Helpful stack trace without resolves/rejects:
test('script with fixed version',async()=>{consturl=`https://unpkg.com/${name}@${version}/index.js`expect(awaitcdnm.updateDependency(createScript(url))).toEqual(createScript(replaceVersion(url)))})
What is the expected behavior?
Stack frames should ideally include my source files because the error originates from my source files (it's not internal to Jest). This happens if I avoid resolves and rejects by using async functions or testing code that doesn't use Promises at all.
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
Jest 21.2.1
Node 8.6.0
npm 5.4.2
macOS 10.13
The text was updated successfully, but these errors were encountered:
test('async reject no stack',async()=>{awaitexpect(Promise.resolve('test')).resolves.toEqual('tost');});
produces:
at Object.<anonymous> (../jest/node_modules/expect/build/index.js:139:54)
at Generator.next (<anonymous>)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
Do you want to request a feature or report a bug?
Either a bug or a missing feature for
resolves
andrejects
.What is the current behavior?
When
resolves
orrejects
are used, stack traces only include stack frames internal to expect, Jest, and Node, not the source files that caused the error.If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can
yarn install
andyarn test
.Use the
expect(...).resolves
or.rejects
syntax, either returning the expression or using anasync
function withawait
beforeexpect
. This issue can be avoided by usingasync
functions withoutresolves
/rejects
, which I'm currently using as a workaround.Unhelpful stack trace with
resolves
/rejects
:Helpful stack trace without
resolves
/rejects
:What is the expected behavior?
Stack frames should ideally include my source files because the error originates from my source files (it's not internal to Jest). This happens if I avoid
resolves
andrejects
by usingasync
functions or testing code that doesn't use Promises at all.Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
The text was updated successfully, but these errors were encountered: