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. Learn more →
Top 23 JavaScript Testing Projects
-
😎 A great list that will increase your Node.js knowledge with practice -> nodebestpractices
-
/** * 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!
-
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)
😎 You want to take your JS testing skills to the next level, here is a nice repo -> javascript-testing-best-practices
-
Ava for a simpler environment than Jest, which I usually use. I need to check how to mock ESM with it, though.
-
GitHub link: https://github.com/enzymejs/enzyme
-
react-testing-library
🐐 Simple and complete React DOM testing utilities that encourage good testing practices.
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.
-
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.
So they need https://www.npmjs.com/package/volkswagen
-
Project mention: A guide for technical writers on JavaScript Testing Libraries | dev.to | 2022-08-13
NightWatchJS
-
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.
-
-
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.
-
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:
-
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)
-
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: 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/
-
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 – 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.
-
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.
-
https://github.com/pa11y/pa11y - Tool for testing ally using node.js (it also has integration 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.
JavaScript Testing related posts
- Hasura E2E tests chronicles, February 2023
- Testing Vue components the right way
- Using Mocha & chai test you React application
- Test driven development is adhd dream
- 10 GitHub repositories you must know as a JavaScript developer
- What's your CI/CD flow made of?
- 10 Must-Know GitHub Repositories for JavaScript Developers
-
A note from our sponsor - InfluxDB
www.influxdata.com | 8 Feb 2023
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 |