General Purpose Testing Tools
In such an environment, tests can be performed very quickly. The minus jsdom is that not everything can be simulated outside the real browser (for example, this approach will not take screenshots), so the use of this tool limits the testing capabilities.
It is worth mentioning that the JS community is working intensively on jsdom and is improving this tool. The capabilities of its current version are very close to the current browser.
The Istanbul tool allows you to analyze code coverage with unit tests. He displays detailed reports, focusing on which you can get an accurate idea of what has not yet been tested in the project, and estimate the amount of work needed to improve the situation.
Karma allows you to run tests in the browser and in environments that resemble browsers, including jsdom.
Karma supports a testing server with a special web page, in the environment of which tests will be performed. This page can be opened in a variety of browsers. In addition, this means the possibility of remote testing using services like BrowserStack .
Chai is the most popular assertion making library.
Unexpected is a library for creating statements, the syntax of which is slightly different from Chai. In addition, this library is extensible, allowing you to create more advanced statements. In particular, we are talking about the use of libraries based on unexpected, for example, such as unexpected-react.
Testdouble.js is a less popular library that performs the same functions as Sinon, while its developers say that it solves similar problems better than Sinon. It differs in a set of features, some features of the architecture and an approach to testing, which can make it useful in many situations. Details about testdouble can be read here , here and here .
Wallaby is another tool worth mentioning. It is not free, but many users believe that it is worth the money that they ask for it. Wallaby works in the IDE (all major IDEs are supported) and performs tests corresponding to code changes. Data on test results are displayed in real time in the same place where the code is located.
Cucumber helps developers with writing tests in BDD. Tests are divided between the acceptance criteria files prepared using the Gherkin syntax and the test files themselves that correspond to them. Tests can be written in various languages that the framework supports, including JS.
Many commands find this syntax more convenient than TDD.
We reviewed the most popular web project testing tools. What exactly is right for you? Perhaps here we can say that the best architectural solutions in the field of modern web applications are a combination of common, time-tested patterns developed by the developer community and the features of a particular application. And to find what is needed for a specific project, it is possible in only one way: to experience everything that seems appropriate in practice.
You might be also interested in: