Introducing
The Slant team built an AI & it’s awesome
Find the best product instantly
Add to Chrome
Add to Edge
Add to Firefox
Add to Opera
Add to Brave
Add to Safari
Try it now
4.7 star rating
0
Development
Web
What are the best JavaScript unit testing tools?
14
Options
Considered
70
User
Recs.
Apr 13, 2021
Last
Updated
Related Questions
Activity
Have feedback or ideas?
Join our community
on Discord
Ad
13
Options
Considered
Best JavaScript unit testing tools
Price
Last Updated
26
Mocha
-
Apr 24, 2019
--
Jasmine
-
Apr 25, 2017
--
CasperJS
-
Apr 28, 2017
--
Karma
-
Dec 26, 2016
--
tape
-
May 16, 2017
See Full List
26
Mocha
My Rec
ommendation
for
Mocha
My Recommendation for
Mocha
All
9
Pros
7
Cons
2
Top
Pro
•••
Write tests with Behavior Driven Development (BDD)
Even though this may not be a Pro for everyone. It all depends on the kind of testing you want; TDD or BDD.
See More
Top
Con
•••
Mocha runs all the tests in the same process which means shared memory, and no independence or isolation
See More
Top
Pro
•••
Supports different assertion libraries
Mocha runs independently from the assertion library, so you can choose which assertion format works best for you. Mocha most often is run in combination with assertion library Chai.
See More
Top
Con
•••
Can be intimidating for beginners
While some testing frameworks are complete out of the box, Mocha requires developers to select and set up assertion libraries and mocking utilities.
See More
Top
Pro
•••
Makes Asynchronous testing extremely easy
No need to write tricky statements for Async testing. Mocha gives you a "Done" callback. Place this "Done" parameter in your callback function, that'll let Mocha know that you've written an asynchronous function. It's that dead simple.
See More
Top
Pro
•••
Integrates really well with NodeJS
The Mocha test framework itself runs on NodeJS, hence it makes everything related to it extremely simple. With Mocha's simple syntax and speed, testing your node.js app just got a whole lot easier.
See More
Top
Pro
•••
Custom full color test reporters
Mocha has multiple test reporters built in and you can create your own as well. The test reporters have full color and makes it easy to see if your tests fail or not.
See More
Top
Pro
•••
Runs in Node.js and the browser
Mocha has a browser build as well as a node command line program so you can test in client and server side environments.
See More
Top
Pro
•••
Easy to add support for Generators
Aside from the numerous benefits with generators in your application, You can now also integrate generators into your test suite. By using mocha, all you have to do is enable support for generators.
See More
Hide
See All
Get it
here
Recommend
28
3
--
Jasmine
My Rec
ommendation
for
Jasmine
My Recommendation for
Jasmine
All
6
Pros
5
Cons
1
Top
Pro
•••
Behaviour Driven Development focused
If you prefer your test cases and applications to be developed from the perspective of your stake holders, Jasmine is the framework for you.
See More
Top
Con
•••
Maintainers are not very responsive to pull requests
Pivotal aren't responsive to pull requests, though they have made repo changes within < 3 months
See More
Top
Pro
•••
Easy to find Jasmine tutorials for most MV* frameworks,
whilst Mocha is still considered the new kid on the block.
See More
Top
Pro
•••
Has a very readable and user-friendly syntax
Code readability is an important factor, if the application development involves multiple teams; if the testing team is unable to read your test cases then they won't be able to test it. Jasmine resolves this issue by providing developers with an extremely simple and "human-friendly" syntax.
See More
Top
Pro
•••
Allows both DOM-less as well as asynchronous testing
If you have some test cases that do not involve testing of DOM elements or events, those are exactly the ones where you want to use Jasmine. It'll provide smooth, simple and easy DOM-less testing of those test cases.
See More
Top
Pro
•••
Integrates very well with Ruby on Rails
The jasmine-rails gem allows you to run Jasmine specs in a browser (powered by Rails engine mounted into your application).
See More
Hide
See All
Get it
here
Recommend
11
--
CasperJS
My Rec
ommendation
for
CasperJS
My Recommendation for
CasperJS
All
7
Pros
5
Cons
2
Top
Pro
•••
Allows screenshots (either the full page or parts of it) if performing UI testing
There are times where you don't want to open up a browser for screencaps, that is where CasperJS comes to use, it can render the page using its own rendering engine and take and save a screenshot for you, all via the commandline
See More
Top
Con
•••
Not for unit testing but rather UI testing
These are two extremely different concepts. CasperJS should be removed from this list
See More
Top
Pro
•••
Easy to understand
See More
Top
Con
•••
Cannot guarantee 100% accurate Webkit-based browser screenshots
QtWebKit is the rendering engine used by CasperJS. Keep in mind this is NOT the same rendering engine as Chrome; hence, if you want to be 100% sure of the results, you must run a Webkit browser (such as Chrome) yourself.
See More
Top
Pro
•••
Written in JavaScript
Since all webdevs know JS, the start-up time of learning the framework will be reduced to zero, as your team can be productive from day one.
See More
Top
Pro
•••
Easily integrates with other applications
Due to the simplicity of the framework, not only other libraries can be built with it, but it can be integrated with any web application as well.
See More
Top
Pro
•••
Can run javascript code inside pages being tested
Can execute arbitrary javascript or load external JS into the page being tested. This feature is possible due to the presence of a rendering engine, and helps you see the effects of any client side scripting during your tests.
See More
Hide
See All
Get it
here
Recommend
6
1
--
Karma
My Rec
ommendation
for
Karma
My Recommendation for
Karma
All
7
Pros
5
Cons
2
Top
Pro
•••
Easily extensible
Do you prefer other test frameworks such as Mocha, Jasmine, qUnit or any other framework? Well you're in luck as Karma can be easiliy be extended to wrap around ANY framework of your choice.
See More
Top
Con
•••
No Support for NodeJS testing
Currently Karma doesn't support testing of apps built on NodeJS. So if you have a node app, you don't want to use Karma, Mocha or Jasmine can do the job for you.
See More
Top
Pro
•••
Provides both Browser based testing as well as headless tests
Karma eases out the UI testing process as you can test your code on all your devices let it be smartphones, tablets or your very own desktop. If you don't want all of that, you always have the option of headless testing using a PhantomJS instance.
See More
Top
Con
•••
No plugin for Eclipse (yet)
Do most of your code using Eclipse, well, you're in bad luck. Karma doesn't have an eclipse plugin, though if you are a real die hard eclipse fan, you can see this little hack to be able to run Karma from inside Eclipse Link (Time of writing: July 2014)
See More
Top
Pro
•••
Provides the option of running client/servers either separately or on the Development computer
These options are really helpful in cases, where you have the luxury of multiple machines (tablets, mobile phones desktops) around you.
See More
Top
Pro
•••
You can test your code in cross browser environments
Being able to test your code directly via your testing tool is a breeze! You don't need to download a fancy tool to see how your app looks in a number of different browsers, now that Karma would do the job for you.
See More
Top
Pro
•••
Has plugins for WebStorm and is supported by the Netbeans IDE
Thanks to Karma, you won't need to spawn up a new terminal just so that you can test your app, you can now code and test right from the IDE
See More
Hide
See All
Get it
here
Recommend
5
4
--
tape
My Rec
ommendation
for
tape
My Recommendation for
tape
All
4
Pros
3
Cons
1
Top
Pro
•••
No global functions
Tape does not use global methods such as "it", "describe", since they are not considered best practice in JavaScript.
See More
Top
Con
•••
No concurrency
Cannot run async test cases concurrently for faster test builds.
See More
Top
Pro
•••
Built-in assert
This way you don't have to add more dependencies and external assertion libraries.
See More
Top
Pro
•••
Simple API
Very simple API that doesn't require globals, or monkey patching objects for assertions.
See More
Hide
See All
Get it
here
Recommend
--
QUnit
My Rec
ommendation
for
QUnit
My Recommendation for
QUnit
All
4
Pros
3
Cons
1
Top
Pro
•••
Tests run in the order they're added to the suite
In cases where you want (I know your test cases must be atomic) where you really really want your test cases to run in a specific order, maybe if the current one rely on those of previous case, you can use Qunit by setting QUnit.config.reorder = false and your test cases will run in the order you've provided.
See More
Top
Con
•••
Testing of Async operations can be a little tough at times.
Qunit, expects us to call the start() function before the Async function itself, and stop() after it stops. This can be a problem when you have no way of knowing, when your function will start or stop (your testing a number of dependent functions)
See More
Top
Pro
•••
Works really well if performing DOM Testing
All frontend developers already know the ease that jQuery framework has brought to their lives, in handling DOM events and accessing elements. Since Qunit was built as a part of jquery (is even used by jQuery itself for unit testing) hence it makes testing of DOM elements a lot easier.
See More
Top
Pro
•••
Extremely easy to start from scratch
Seriously! All you have to do is include the Qunit library from the CDN, then create your Testcases js file, and RUN IT! . Your outputs would be displayed in a pretty little format in your browser.
See More
Hide
See All
Get it
here
Recommend
2
--
Ava
My Rec
ommendation
for
Ava
My Recommendation for
Ava
All
2
Pros
1
Cons
1
Top
Con
•••
No browser testing supported
Only supports tests in Node and the backend and not the browser.
See More
Top
Pro
•••
Isolated tests
Each test is run in isolation.
See More
Hide
Get it
here
Recommend
3
--
Testcafe
My Rec
ommendation
for
Testcafe
My Recommendation for
Testcafe
Hide
Get it
here
Recommend
1
--
BusterJS
My Rec
ommendation
for
BusterJS
My Recommendation for
BusterJS
All
6
Pros
4
Cons
2
Top
Pro
•••
Supports deferring tests
No need to comment out your entire test case, now that you have Buster, which supports deferring a test so it doesn't actually run, but you get notified that there’s a deferred tests every time you run your test suite.
See More
Top
Con
•••
Has no plugins for major IDE's (Eclipse/IntelliJ) yet.
Do you prefer running your test cases from inside your IDE? well BusterJS will make that a lot difficult for you if not impossible. You'll have to run Buster using the good old way of spawning up a new terminal for running the tests.
See More
Top
Pro
•••
Flexible; extend it to wrap other test-frameworks
Have your test cases written in another framework, want to use BusterJS to run the tests, then you're in luck. BusterJS can be easily wrapped around other test frameworks. If you need to know how to do it, here's a link that showing just that.
See More
Top
Con
•••
Currently still in Beta; some of the stuff still has bugs
Time of writing : 31st July 2014
See More
Top
Pro
•••
Has support for NodeJS testing.
Working on a NodeJS app? BusterJS can help you Unit test it. This pretty much works just like browser tests, but you need to require Buster.JS in your tests.
See More
Top
Pro
•••
You have the option of either running tests headless or via the browser
Don't have time to go through the lengthy process of opening up your browsers? BusterJS gives you the option of performing Headless tests. These are powered by PhantomJS; hence all your testing is done within the command line.
See More
Hide
See All
Get it
here
Recommend
2
--
Intern
My Rec
ommendation
for
Intern
My Recommendation for
Intern
All
4
Pros
4
Top
Pro
•••
Good documentation
Well documented with easily available examples repository.
See More
Top
Pro
•••
Run Tests in Browser
See More
Top
Pro
•••
Code coverage
See More
Top
Pro
•••
CI services integration
Can be integrated to work with Jenkins or TeamCity.
See More
Hide
See All
Get it
here
Recommend
1
--
Spectacular
My Rec
ommendation
for
Spectacular
My Recommendation for
Spectacular
All
1
Cons
1
Top
Con
•••
Inactive project
Spectacular has not been contributed to in over a year, and the last active issues posted to GitHub were in 2013.
See More
Hide
Get it
here
Recommend
1
1
--
Painless
My Rec
ommendation
for
Painless
My Recommendation for
Painless
Hide
Get it
here
Recommend
--
Testem
My Rec
ommendation
for
Testem
My Recommendation for
Testem
Hide
Get it
here
Recommend
Don't see your favorite option? Add it.
--
JS Page
My Rec
ommendation
for
JS Page
My Recommendation for
JS Page
29.99
Recommend
1
See flagged products
Hide flagged products
Built By the Slant team
Find the best product instantly.
4.7 star rating
Add to Chrome
Add to Edge
Add to Firefox
Add to Opera
Add to Brave
Add to Safari
Try it now - it's free
One sec!
Are you sure that you want to abandon your hard work?
Delete Work
Continue working
{}
undefined
url next
price drop