react-testing-library VS Sinon.JS

Compare react-testing-library vs Sinon.JS and see what are their differences.

react-testing-library

🐐 Simple and complete React DOM testing utilities that encourage good testing practices. [Moved to: https://github.com/testing-library/react-testing-library] (by kentcdodds)
SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
surveyjs.io
featured
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
react-testing-library Sinon.JS
5 28
16,049 9,563
- 0.2%
6.0 8.2
about 2 years ago 7 days ago
JavaScript JavaScript
MIT License GNU General Public License v3.0 or later
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

react-testing-library

Posts with mentions or reviews of react-testing-library. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-05-15.
  • fireEvent not properly calling event in react-testing-library
    2 projects | /r/codehunter | 15 May 2022
    I'm currently testing an input using Jest & react-testing-library. I'm trying to test whether the onChange function fires whenever my input's field changes. Here's an example of my code:
  • React testing library on change for Material UI Select component
    1 project | /r/codehunter | 26 Mar 2022
    I am trying to test the onChange event of a Select component using react-testing-library.
  • How to query by text string which contains html tags using React Testing Library?
    1 project | /r/codehunter | 18 Mar 2022
    Reactjs Current Working Solution Using this html: Name: Bob (special guest) I can use the React Testing Library getByTestId method to find the textContent: expect(getByTestId('foo').textContent).toEqual('Name: Bob (special guest)') Is there a better way? I would like to simply use this html: Name: Bob (special guest) And use React Testing Library's getByText method like this: expect(getByText('Name: Bob (special guest)')).toBeTruthy() But this does not work. So, the question… Is there a simpler way to use React Testing Library to find strings of text content with the tags striped out? Answer link : https://codehunter.cc/a/reactjs/how-to-query-by-text-string-which-contains-html-tags-using-react-testing-library
  • TypeError: scrollIntoView is not a function
    1 project | /r/codehunter | 17 Mar 2022
    I am new to react-testing-library / jest and attempting to write a test to see if the navigation of routes (using react-router-dom) is performed correctly. So far I have been following the README and this tutorial on how to use.
  • Find element by id in react-testing-library
    1 project | /r/codehunter | 15 Mar 2022
    I'm using react-testing-libarary to test my react application. For some reason, I need to be able to find the element by id and not data-testid. There is no way to achieve this in the documentation.

Sinon.JS

Posts with mentions or reviews of Sinon.JS. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-03-03.
  • Unit Testing in Node.js and TypeScript: A Comprehensive Guide with Jest Integration
    5 projects | dev.to | 3 Mar 2024
    If you are using a mocking library, such as sinon, jest-mock, or ts-mockito, make sure that it is compatible with Jest. You may need to install additional packages or configure them in your configuration file. For example, to use sinon with Jest, you can install the sinon-jest package and add the following to your configuration file:
  • Express API Testing
    14 projects | /r/node | 7 Mar 2023
    Mocha is a test runner, Chai is an assertion library, Sinon is a mocking library, this normally the combination you would need to use if you choose mocha, but there are others.
  • Alternative to AWS Mock
    2 projects | dev.to | 15 Feb 2023
    Instead, use pure functions + dependency inject your stubs (e.g. parameter to function). Also note, no need for Sinon or some other test double library. JavaScript is so good nowadays to easily make objects/classes/functions or any combination thereof on the fly that are terse.
  • Unit testing: What to use, and how?
    5 projects | /r/node | 13 Feb 2023
    I've had some good experiences with Ava + Sinon. I've personally disliked Jest because it seemed to do some weird trickery in the background that prevented me from using ES modules.
  • Can AI help me write tests on legacy code?
    8 projects | dev.to | 9 Feb 2023
    🤖 You can use the Mocha testing framework with the Chai assertion library to write tests for your Express controller. You can also use the Sinon library to mock the database calls. This will allow you to test the controller without actually making a call to the database. You can also use the SuperTest library to make HTTP requests to the controller and test the response.
  • Need help writing a jest test that mocks an API call which will update state
    2 projects | /r/react | 29 Sep 2022
    You can use sinon js to create a mock version of your http library (axios) that responds with the data you’re expecting.
  • Unit testing with React and Cypress
    4 projects | dev.to | 14 Sep 2022
    Assertions are the checkpoints of our test block that confirm if an automated test has passed or failed. Cypress bundles the Chai, jQuery, and Sinon.JS libraries for assertions. They check the desired, expected application in which the test is running. A complete listing of assertions can be found in the documentation here.
  • When to use DI?
    1 project | /r/typescript | 12 Sep 2022
    ES module is basically a "class" that you inject dependencies into through imports. And for tests you just use something like sinon to swap module dependencies for mocks.
  • How to test a function that uses moment to format a date ? usimg karma
    1 project | /r/angularjs | 25 Aug 2022
    You can use a tool like sinon to pass in your own function instead of the real moment library. From there you can write tests that ensure moment was invoked appropriately.
  • Typescript boilerplate test configuration with mocha, chai and sinon
    3 projects | dev.to | 17 Aug 2022
    Let's configure tests with mocha, chai and sinon on Typescript in a few steps.

What are some alternatives?

When comparing react-testing-library and Sinon.JS you can also consider the following projects:

react-beautiful-dnd - Beautiful and accessible drag and drop for lists with React

jest - Delightful JavaScript Testing.

wordle - Created my own Wordle app with dark mode compatibility using ReactJS

chai - BDD / TDD assertion framework for node.js and the browser that can be paired with any testing framework.

reactjs-interview-questions - List of top 500 ReactJS Interview Questions & Answers....Coding exercise questions are coming soon!!

proxyquire - 🔮 Proxies nodejs require in order to allow overriding dependencies during testing.

cv-generator - Using React, Google Sheets, and CSS to create a dynamic cv and cover letter generator.

Playwright - Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

Enzyme - JavaScript Testing utilities for React

tap - Test Anything Protocol tools for node

javascript-todo-list-tutorial - ✅ A step-by-step complete beginner example/tutorial for building a Todo List App (TodoMVC) from scratch in JavaScript following Test Driven Development (TDD) best practice. 🌱

ava - Node.js test runner that lets you develop with confidence 🚀