Comments (3)
expect() doesn't exit as soon as the expected number of assertions have run, but rather checks that the completed number of assertions on test.done matches what you expect. This is to help detect callbacks firing multiple times or not at all.
From your code example it looks like you want to exit as soon as a specific number of assertions have been run. The problem with this is that you have no idea whether extra calls are being made to the callbacks, or which assertions have fired. It could be that your first assertion has fired 10 times by mistake, but passed each time.
from nodeunit.
I need to do this because I found that, for a particularly well nested (and heavy) callback, nodeunit would print the results 'early' and assume a couple of tests hadn't run when actually they were running but just taking a while.
I suppose what I'm trying to achieve is done() blocking until at least the expected count has been met. Is there a common idiom for dealing with this scenario?
edit: "isnt" sould be "<" in the code.
from nodeunit.
Oh, also, you would call superdone in the same place you might done() - so would still catch too many test runs.
from nodeunit.
Related Issues (20)
- Some reporters do not display assertion error message HOT 4
- TAP reporter is broken in [email protected]+ (works in nodeunit 0.9.2) HOT 9
- issues with the _deepEqual algorithm HOT 2
- replace the old makefile with browserify or webpack
- Add explicit process exit on success HOT 1
- nodeunit.js in examples/browser is out of date HOT 1
- Incorrect exit code when running multiple directories HOT 2
- ReferenceError when using junit reporter in 0.11.0 HOT 4
- Q: Is there a better way to dynamically create tests than a monkey-patch? HOT 1
- Release 0.11.1 HOT 1
- FYI: nodeunit plugin for exhaustive testing of asynchronous sequences HOT 1
- setUp & tearDown not called as docs would imply
- Ways to skip, and run single(s) tests
- ES6 Module export
- Use template-literal instead of EJS
- Not all reporters support recursion. HOT 7
- Tap dependency update to v11 HOT 9
- make test on fresh clone failes due to undeclared dependencies HOT 1
- How to export function from module without nodeunit testing it?
- how to output html reporter to the file HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nodeunit.