I'm using a testing setup with Mocha.js and a lot of promises within the tests. The tests depend on setting up stuff in the DOM, and between tests, the DOM is cleared. However, sometimes the tests run slowly and time out. In this case, their promises continue to execute but the DOM is cleared before the next test, so the promise may incorrectly throw errors into the next test. Is there a way to cancel or destroy all outstanding promises in-between tests? We are using when.js promises.
'Zombie promises' continuing after a mocha.js test timeout
434 Views Asked by dandelion At
1
There are 1 best solutions below
Related Questions in JAVASCRIPT
- Angular Show All When No Filter Is Supplied
- Why does a function show up as not defined
- I count the time the user takes to solve my quiz using Javascript but I want the same time displayed on another page
- Set "More" "Less" font size
- Using pagination on a table in AngularJS
- How to sort these using Javascript or Jquery Most effectively
- how to fill out the table with next values in array with one button
- State with different subviews
- Ajax jQuery firing multiple time display event for the same result
- Getting and passing MVC Model data to AngularJS controller
- Disable variable in eval
- javascript nested loops waiting for user input
- .hover() seems to overwrite .click()
- How to sort a multi-dimensional array by the second array in descending order?
- How do I find the fonts that are not loading in a CORS situation ( MoovWeb )?
Related Questions in MOCHA.JS
- NodeJs and Mocha testing the response
- Need help in passing this simple mocha test in javascript
- Listen to the 'reloading' event of watch (e.g. to close db connection) in mocha test
- Using after to clean up in mocha, problems with mongo
- PackT book - Advanced Express Web App Dev
- Istanbul code coverage for Mocha tests
- Testing ElasticSearch with Node. Force update index after populating MongoDB
- Supertest and Mongoose Middleware (post remove)
- Bypass ESLint's `no-unused-var` for Should in a Mocha test
- Webstorm: Debugging Mocha tests written in ES6
- undefined is not a function while testing ReactJS using Mocha
- Mocha watch doesnt trigger on new files
- How can we check if Simulate.change method is working when testing a react component?
- Kick off mocha tests in Visual Studio Team Services Build
- Chai, testing that function throws correct error
Related Questions in PROMISE
- Implementing a fallback using promises
- XHR progress event microtask queue
- How to return from a promise if Ajax is not required?
- Passing "this" inside a promise?
- Differences between Deferred.then(null,func) and Deferred.fail(func) in JQuery?
- Acces to jQuery $.get URL from Bluebird Promise object
- Is .finally in the ES6 specification?
- When Promisifying a XMLHttpRequest, how to catch a throw Error
- Nesting Asynchronous Promises in ActionScript
- Promise doesn't resolve the right value
- delay for jquery promises
- promise – can't find variable process
- Ember RSVP.Promise resolve function return undefined
- Nodejs Promise.all() resolving always
- How does Q.all work in NodeJS?
Related Questions in WHEN-JS
- using reqwest and when for making remote calls
- Promises: Refactoring Progress when the number of progress updates is unknown
- How to hide and show table rows in XSL file according to the string returning null or not from JS file
- 'Zombie promises' continuing after a mocha.js test timeout
- Synchronize promises created asynchronously
- How to fetch a list of objects and wait for them to finish?
- What is the when.js equivalent of Q.js's "done()"?
- Cleaning up promises (flattening and error handling)
- node.js mongoose.js memory leak?
- Understanding promises in javascript using when library
- How to cleanly extract a callback out of a when.js promise?
- How to install library 'When' in Javascript
- promises not getting resolved while testing directive using jasmine
- How can Ajax wait for user input?
- What is the difference between `when(foo, f)` and `when(foo).then(f)`
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
when.jssupports acancel()method. You could call it from aafterEachorafterblock in mocha. You might need to create an array at the top of each mocha file (or as global) to track your outstanding promises.