awesome-repositories.com
Blog
awesome-repositories.com

Découvrez les meilleurs dépôts open-source grâce à notre recherche par IA.

ExplorerRecherches sélectionnéesAlternatives open sourceLogiciels auto-hébergésBlogPlan du site
ProjetÀ proposNotre méthodologiePresseServeur MCP
Mentions légalesConfidentialitéConditions d'utilisation
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·
sapegin avatar

sapegin/jest-cheat-sheet

0
View on GitHub↗
5,428 stars·704 forks·CC0-1.0·13 vues

Jest Cheat Sheet

Ce projet est un guide de référence complet et une antisèche pour le framework de test Jest. Il fournit une documentation technique et des exemples de syntaxe pour écrire des tests unitaires JavaScript, en se concentrant sur les assertions, les stratégies de mocking et la configuration des suites de tests.

La ressource détaille des méthodes spécifiques pour l'isolation des dépendances et le mocking, incluant l'utilisation de timers fictifs, de substitutions au niveau des modules et la vérification des appels de fonction. Elle couvre également des workflows spécialisés comme le snapshot testing pour détecter les régressions via des comparaisons de sorties sérialisées.

Le guide aborde en outre les patterns de tests asynchrones, les tests pilotés par les données via injection paramétrée, et l'organisation des suites de tests via des procédures de setup et teardown de cycle de vie. Il inclut des instructions pour valider les valeurs de données, vérifier la gestion des exceptions et filtrer l'exécution des tests.

Features

  • Testing Framework Cheat Sheets - Serves as a comprehensive reference and cheat sheet for writing and running test suites with Jest.
  • Cheat Sheets - Acts as a concise reference guide for Jest assertions, mocking, and test suite configuration.
  • Asynchronous Logic Validation - Guides users on verifying promises and asynchronous patterns to ensure assertions execute correctly.
  • Dependency Mocking - Provides detailed strategies for isolating code by substituting real modules and functions with mocks.
  • Fake Timers - Provides techniques for replacing native clocks with fake timers to execute delayed logic synchronously.
  • Asynchronous Test Handling - Offers a comprehensive guide to verifying promises and time-based logic using asynchronous test patterns.
  • Dependency Mocking - Provides detailed examples of substituting real module dependencies with programmable mock implementations.
  • Timer Mocks - Shows how to control native timer functions to write synchronous tests for time-dependent logic.
  • Value Equality Assertions - Offers a reference for validating data values using strict equality, numeric ranges, and string patterns.
  • Exception Assertions - Provides syntax for asserting that functions throw specific errors or match expected exception messages.
  • Unit Testing - Provides a collection of syntax examples and best practices for writing isolated unit tests in JavaScript.
  • Method Interception Spies - Details how to use spies to track object method calls, getters, and setters without altering original behavior.
  • Test Suite Organization - Details the organization of test suites using grouping and lifecycle setup and teardown procedures.
  • Call-Stack Interceptors - Details how to capture method invocations and arguments using spy functions to verify behavior.
  • Data-Driven Testing - Demonstrates how to use parameterized injection to execute a single test template against multiple input sets.
  • Function Call Tracking - Shows how to track function invocations, count calls, and inspect arguments passed to mocks.
  • Mock State Resetting - Details how to clear internal call history and restore original function implementations between tests.
  • Test Parameterization - Demonstrates how to run the same test logic against multiple data sets using parameterized injection.
  • Mock Behavior Configuration - Explains how to define return values and sequential responses for mock functions to simulate dependency outcomes.
  • Module Registry Resets - Explains how to flush the cached module registry to prevent state leakage between tests.
  • Snapshot Testing - Guides the use of serialized output baselines to detect unexpected changes in components or data.
  • Snapshot Diffing - Provides instructions for comparing serialized output snapshots to detect regressions via string diffing.
  • Mocking and Assertion References - Provides a technical resource for implementing fake timers, module mocks, and data validation.
  • Asynchronous Assertions - Provides guidance on using assertions designed to handle the asynchronous lifecycle and prevent tests from finishing prematurely.
  • Test Execution Filtering - Explains how to isolate or exclude specific tests from a run to focus on particular features.
  • Front End Development - Quick reference for Jest testing framework syntax.

Historique des stars

Graphique de l'historique des stars pour sapegin/jest-cheat-sheetGraphique de l'historique des stars pour sapegin/jest-cheat-sheet

Recherche par IA

Explorez plus de dépôts awesome

Décrivez vos besoins en langage naturel — l'IA classe des milliers de projets open source sélectionnés par pertinence.

Start searching with AI

Collections incluant Jest Cheat Sheet

Sélections manuelles où Jest Cheat Sheet apparaît.
  • Fiches mémo pour outils de développement

Alternatives open source à Jest Cheat Sheet

Projets open source similaires, classés selon le nombre de fonctionnalités partagées avec Jest Cheat Sheet.
  • thomhurst/tunitAvatar de thomhurst

    thomhurst/TUnit

    3,744Voir sur GitHub↗

    TUnit is a comprehensive C# testing framework, mocking library, and fluent assertion tool. It utilizes source generation for test discovery and mock creation, ensuring compatibility with Native AOT and IL trimming by eliminating the need for runtime reflection and proxies. The framework provides specialized capabilities for integration testing, including the management of distributed application lifecycles, isolated database schemas, and the correlation of telemetry and logs across process boundaries via OTLP. It also includes an HTTP testing utility to intercept network exchanges and mock AP

    C#csharpdotnettest
    Voir sur GitHub↗3,744
  • substack/tapeAvatar de substack

    substack/tape

    5,800Voir sur GitHub↗

    Tape is a JavaScript testing framework and assertion library that serves as a test runner for Node.js and browser environments. It implements the Test Anything Protocol to provide a standardized, machine-readable format for test results. The project functions as a cross-environment test harness, allowing the same test suites to be executed across both server-side and client-side environments while maintaining a consistent output protocol. Its capabilities include validating value equality and truthiness, verifying exception handling, and coordinating asynchronous workflows. The framework als

    JavaScript
    Voir sur GitHub↗5,800
  • sinonjs/sinonAvatar de sinonjs

    sinonjs/sinon

    9,753Voir sur GitHub↗

    Sinon is a JavaScript test double library and mocking framework used to isolate code and verify behavior during unit testing. It provides a collection of spies, stubs, and mocks that replace real function implementations and object methods with controlled substitutes. The project includes a specialized fake timer library for overriding the system clock, allowing the simulation of time progression to trigger timeouts and intervals without waiting for real-time delays. It also features a test sandbox mechanism to group multiple fakes together, ensuring the original state is restored between tes

    JavaScript
    Voir sur GitHub↗9,753
  • jestjs/jestAvatar de jestjs

    jestjs/jest

    45,448Voir sur GitHub↗

    Jest is a JavaScript testing framework designed for writing and running automated test suites to verify the correctness of JavaScript and TypeScript code. It functions as a comprehensive toolset that integrates a test runner, a mocking and spying library, a snapshot testing tool, and a code coverage tool. The framework distinguishes itself through snapshot testing, which records the serialized state of data structures to detect regressions in future executions. It also includes a mocking and spying library for simulating external dependencies and tracking function calls to isolate code during

    TypeScripteasyexpectationfacebook
    Voir sur GitHub↗45,448
Voir les 30 alternatives à Jest Cheat Sheet→

Questions fréquentes

Que fait sapegin/jest-cheat-sheet ?

Ce projet est un guide de référence complet et une antisèche pour le framework de test Jest. Il fournit une documentation technique et des exemples de syntaxe pour écrire des tests unitaires JavaScript, en se concentrant sur les assertions, les stratégies de mocking et la configuration des suites de tests.

Quelles sont les fonctionnalités principales de sapegin/jest-cheat-sheet ?

Les fonctionnalités principales de sapegin/jest-cheat-sheet sont : Testing Framework Cheat Sheets, Cheat Sheets, Asynchronous Logic Validation, Dependency Mocking, Fake Timers, Asynchronous Test Handling, Timer Mocks, Value Equality Assertions.

Quelles sont les alternatives open-source à sapegin/jest-cheat-sheet ?

Les alternatives open-source à sapegin/jest-cheat-sheet incluent : thomhurst/tunit — TUnit is a comprehensive C# testing framework, mocking library, and fluent assertion tool. It utilizes source… substack/tape — Tape is a JavaScript testing framework and assertion library that serves as a test runner for Node.js and browser… sinonjs/sinon — Sinon is a JavaScript test double library and mocking framework used to isolate code and verify behavior during unit… jestjs/jest — Jest is a JavaScript testing framework designed for writing and running automated test suites to verify the… codeception/codeception — Codeception is a full-stack testing framework for PHP applications that provides a unified interface for unit,… jasmine/jasmine — Jasmine is a JavaScript testing framework and test runner designed for behavior-driven development. It provides a…