Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
New error "Did you forget to return or await the result of expectAsync" is misleading in some cases. #1854
Comments
|
You really shouldn't be mixing the two async styles in a single test. One of them has to win, and the best Jasmine can do is probably just wait for the first one to happen. Currently, Jasmine has the I would be happy to review a pull request to add a note about calling done before actually being done with the test to that error message. |
An asynchronous test case that uses both
expectAsyncanddonecan fail because done finishes the test before the asynchronous code completes. Awaiting the result ofexpectAsyncdoesn't help if the asynchronous part takes longer than the call todone. The error being displayed when running Jasmine doesn't mention this possibility, making the developer focus on the wrong thing.Expected Behavior
The error would also mention the possibility of calling
done()before expectAsync has completed.Current Behavior
The error only hints at forgetting to return/await
expectAsync.Possible Solution
Extend the error message with another line, e.g:
Suite that reproduces the behavior (for bugs)
Context
Combining an async test case with
done()is hopefully very rare, but it happens, especially when combining XHR with events in a single test case.Your Environment