JavaScript Testing

Open-source JavaScript projects categorized as Testing

Top 23 JavaScript Testing Projects

  • nodebestpractices

    :white_check_mark: The Node.js best practices list (November 2022)

    Project mention: Awesome Github Repos to Master JAVASCRIPT | dev.to | 2023-02-03

    😎 A great list that will increase your Node.js knowledge with practice -> nodebestpractices

  • Cypress

    Fast, easy and reliable testing for anything that runs in a browser.

    Project mention: Hasura E2E tests chronicles, February 2023 | dev.to | 2023-02-08

    /** * Wait for a bunch of requests to be settled before proceeding with the test. * * Alternatively, https://github.com/bahmutov/cypress-network-idle could be used * * This is a workaround for "element is 'detached' from the DOM" Cypress' error (see the issue * linked below). Since the UI gets re-rendered because of the requests, this utility ensures that * all the requests parallelly made by the UI are settled before proceeding with the test. Hence, it * ensure the UI won't re-render during the next interaction. * * What are the requests that must be awaited? By looking at the Cypress Test Runner, they are the * following, made parallelly or in a rapid series. * 1. export_metadata * 2. export_metadata * 3. export_metadata * 4. test_webhook_transform * 5. test_webhook_transform * 6. test_webhook_transform * 7. test_webhook_transform * At the moment of writing, I'm not sure the number of requests are fixed or not. If they are fixed, * using the cy.intercept `times` options would result in a more expressive and less convoluted code. * * To give you an overall idea, this is a timeline of the requests * * all requests start all requests end * | | | | * |--🚦🔴--1--2--3--4--5--6--7----------------------------1--2--3--4--5--6-7--🚦🟢--| * * * ATTENTION: Despite the defensive approach and the flakiness-removal purpose, this function could * introduced even more flakiness because of its empiric approach. In case of failures, it must be * carefully evaluated when/if keeping it or thinking about a better approach. * In general, this solution does not scale, it should not be spread among the tests. * * @see https://github.com/cypress-io/cypress/issues/7306 * @see https://glebbahmutov.com/blog/detached/ * @see https://github.com/bahmutov/cypress-network-idle */ import 'cypress-wait-until'; export function waitForPostCreationRequests() { let waitCompleted = false; cy.log('*--- All requests must be settled*'); const pendingRequests = new Map(); cy.intercept('POST', 'http://localhost:8080/v1/metadata', req => { if (waitCompleted) return; Cypress.log({ message: '*--- Request pending*' }); pendingRequests.set(req, true); req.continue(() => { Cypress.log({ message: '*--- Request settled*' }); pendingRequests.delete(req); }); }); Cypress.log({ message: '*--- Waiting for the first request to start*' }); // Check if at least one request has been caught. This check must protect from the following case // // check requests start test failure, the requests got the UI re-rendered // | | | // |--🚦🔴----⚠️---🚦🟢-------1-2-3-4-5-6-7-1----------💥 // // where checking that "there are no pending requests" falls in the false positive case where // there are no pending requests because no one started at all. // // The check runs every millisecond to be 100% sure that no request can escape (ex. because of a // super fast server). A false-negative case represented here // // requests start requests end check check test failure, no first request caught // | | | | | | | // |--🚦🔴--1-2-3-4-5-6-7-1-2-3-4-5-6-7--⚠️------------------⚠️------------------💥 cy.waitUntil(() => pendingRequests.size > 0, { timeout: 5000, // 5 seconds is the default Cypress wait for a request to start interval: 1, errorMsg: 'No first request caught', }); Cypress.log({ message: '*--- Waiting for all the requests to start*' }); // Let pass some time to collect all the requests. Otherwise, it could detect that the first // request complete and go on with the test, even if another one will be performed in a while. // // This fixed wait protects from the following timeline // // 1st request start first request end other requests start test failure, the requests got the UI re-rendered // | | | | // |--🚦🔴---1---------------------1----🚦🟢----------------2-3-4-5-6-7-1----------💥 // // Obviously, it is an empiric waiting, that also slows down the test. cy.wait(500); Cypress.log({ message: '*--- Waiting for all the requests to be settled*' }); cy.waitUntil(() => pendingRequests.size === 0, { timeout: 30000, // 30 seconds is the default Cypress wait for the request to complete errorMsg: 'Some requests are not settled yet', }).then(() => { waitCompleted = true; }); }

  • Appwrite

    Appwrite - The Open Source Firebase alternative introduces iOS support . Appwrite is an open source backend server that helps you build native iOS applications much faster with realtime APIs for authentication, databases, files storage, cloud functions and much more!

  • mocha

    ☕️ simple, flexible, fun javascript test framework for node.js & the browser

    Project mention: 5 Node.js Tools to Learn in 2023 | dev.to | 2023-02-08

    If you have yet to practice test-driven development (TDD), now is your chance. Mocha integrates seamlessly with all the tools we have covered so far and can run hundreds of unit tests in less than a second.

  • javascript-testing-best-practices

    📗🌐 🚢 Comprehensive and exhaustive JavaScript & Node.js testing best practices (December 2022)

    Project mention: Awesome Github Repos to Master JAVASCRIPT | dev.to | 2023-02-03

    😎 You want to take your JS testing skills to the next level, here is a nice repo -> javascript-testing-best-practices

  • ava

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

    Project mention: Tech stack discussion | reddit.com/r/PWA | 2023-01-08

    Ava for a simpler environment than Jest, which I usually use. I need to check how to mock ESM with it, though.

  • Enzyme

    JavaScript Testing utilities for React

    Project mention: Top OpenAI Tools, Examples & Use Cases | dev.to | 2023-02-06

    GitHub link: https://github.com/enzymejs/enzyme

  • react-testing-library

    🐐 Simple and complete React DOM testing utilities that encourage good testing practices.

    Project mention: Some Very Cool (Underrated maybe) React Libraries | dev.to | 2023-02-08

    React Testing Library: This library provides simple and complete React DOM testing utilities that encourage good testing practices. It helps you write tests that are more focused on the behavior of your components rather than the implementation details. https://github.com/testing-library/react-testing-library

  • InfluxDB

    Build time-series-based applications quickly and at scale.. InfluxDB is the Time Series Platform where developers build real-time applications for analytics, IoT and cloud-native services. Easy to start, it is available in the cloud or on-premises.

  • jasmine

    Simple JavaScript testing framework for browsers and node.js

    Project mention: Common Pitfalls in Angular Component Testing | dev.to | 2023-01-28

    Learn more about Jasmine and Karma

  • volkswagen

    :see_no_evil: Volkswagen detects when your tests are being run in a CI server, and makes them pass.

    Project mention: Das Auto. | reddit.com/r/funny | 2022-11-03

    So they need https://www.npmjs.com/package/volkswagen

  • nightwatch

    End-to-end testing framework written in Node.js and using the W3C Webdriver API

    Project mention: A guide for technical writers on JavaScript Testing Libraries | dev.to | 2022-08-13

    NightWatchJS

  • Detox

    Gray box end-to-end testing and automation framework for mobile apps

    Project mention: React vs React Native: How Different Are They, Really? | dev.to | 2022-12-19

    End-to-end testing is completely different on React Native, however. None of the Selenium-based E2E testing tools will work; neither will newer tools like Cypress or Playwright. You may have expected this - these are all DOM-based, and there’s no DOM in React Native. So instead developers will have to learn Detox or Appium.

  • web-skills

    A visual overview of useful skills to learn as a web developer

  • tape

    tap-producing test harness for node and browsers

    Project mention: Straight talk: Salary discussion thread | reddit.com/r/Thailand | 2022-12-18

    OK will do. Do you have any tips on finding a suitable project? Ideally I was hoping to to contribute to a piece of software that I actually use/know/like/want to improve. Given that, and my area of expertise, I had shortlisted Signal Desktop, and Tape.

  • nyc

    the Istanbul command line interface

    Project mention: Testing Vue components the right way | dev.to | 2023-02-06

    Writing tests is essential, and knowing whether you test all the required cases for your logic is even more critical. The most common testing coverage tool is Istanbul, where you can see how well your tests exercise your code by lines, functions, and branches. Below is an example of how the test coverage report looks in your terminal:

  • axe-core

    Accessibility engine for automated Web UI testing

    Project mention: Don't overlook accessibility: Why it's crucial for website development | dev.to | 2023-01-22

    aXe - The Standard in Accessibility Testing from deque (free)

  • miragejs

    A client-side server to build, test and share your JavaScript app

    Project mention: e2e testing setup and thoughts on Playwright | reddit.com/r/ExperiencedDevs | 2022-12-16

    during development we use mirage JS to spin up an in-browser mock server which returns mock data for any API endpoints not currently implemented by the real backend. during integration testing we configure this server to return mock data for all API endpoints in the system, giving us a fixed environment against which our tests can run. test suites can be run in parallel since each time a playwright page is opened a new copy of the webapp, and thus a new copy of the mock server, is launched. these integration tests run whenever a frontend PR is opened or updated.

  • qunit

    🔮 An easy-to-use JavaScript unit testing framework.

    Project mention: Top 15 Must Have Tools For JavaScript Developers | dev.to | 2022-11-09

    QUNIT: QUnit was first installed on NPM, which is a javascript testing framework. It’s a javascript based unit testing framework. For more info: https://qunitjs.com/

  • dredd

    Language-agnostic HTTP API Testing Tool

    Project mention: Integration testing best practices for API servers... | reddit.com/r/golang | 2022-12-05

    If you want to make sure the server implements a certain contract like there's an handler responding to a GET request to /API/what/ever I'd rather use something else. To be completely honest this is a topic I'm currently also searching for a really good solution but what I found so far (and looks promising) is https://dredd.org/ or https://microcks.io/ Both support OpenAPI testing so you can specify the contract as an OpenAPI spec and validate your server against it.

  • CodeceptJS

    Supercharged End 2 End Testing Framework for NodeJS

    Project mention: How to Accelerate Selenide Tests with Playwright | dev.to | 2023-01-04

    CodeceptJS – A wrapper for different tools in one interface. Language: JavaScript/TypeScript. Frameworks that are wrapped: Playwright, Webdriver.io, Puppeteer, Protractor, etc. The service also comes with a large community and is easy to install and use for e2e testing.

  • jest-dom

    :owl: Custom jest matchers to test the state of the DOM

    Project mention: Is there a jest query method for this use case? | reddit.com/r/reactjs | 2022-12-30

    React Testing Library uses jest-dom which has a .getByText() matcher.

  • jest-image-snapshot

    ✨ Jest matcher for image comparisons. Most commonly used for visual regression testing.

  • pa11y

    Pa11y is your automated accessibility testing pal

    Project mention: About a11y in general | dev.to | 2023-01-21

    https://github.com/pa11y/pa11y - Tool for testing ally using node.js (it also has integration with Cypress).

  • cypress-example-recipes

    Various recipes for testing common scenarios with Cypress

    Project mention: Configuring Cypress, cypress-react-unit-test, and React | reddit.com/r/codehunter | 2022-04-07

    I am using the file from their example repo for testing: https://github.com/cypress-io/cypress-example-recipes/blob/master/examples/unit-testing__react/greeting.jsx

  • Sonar

    Write Clean JavaScript Code. Always.. Sonar helps you commit clean code every time. With over 300 unique rules to find JavaScript bugs, code smells & vulnerabilities, Sonar finds the issues while you focus on the work.

NOTE: The open source projects on this list are ordered by number of github stars. The number of mentions indicates repo mentiontions in the last 12 Months or since we started tracking (Dec 2020). The latest post mention was on 2023-02-08.

JavaScript Testing related posts

Index

What are some of the best open-source Testing projects in JavaScript? This list will help you:

Project Stars
1 nodebestpractices 86,002
2 Cypress 42,480
3 mocha 21,875
4 javascript-testing-best-practices 20,441
5 ava 20,221
6 Enzyme 19,964
7 react-testing-library 17,429
8 jasmine 15,495
9 volkswagen 12,567
10 nightwatch 11,298
11 Detox 10,172
12 web-skills 6,367
13 tape 5,728
14 nyc 5,230
15 axe-core 4,941
16 miragejs 4,938
17 qunit 3,990
18 dredd 3,965
19 CodeceptJS 3,847
20 jest-dom 3,772
21 jest-image-snapshot 3,558
22 pa11y 3,553
23 cypress-example-recipes 3,071
Write Clean JavaScript Code. Always.
Sonar helps you commit clean code every time. With over 300 unique rules to find JavaScript bugs, code smells & vulnerabilities, Sonar finds the issues while you focus on the work.
www.sonarsource.com