All Projects → kentcdodds → Js Mocking Fundamentals

kentcdodds / Js Mocking Fundamentals

Licence: other
JavaScript Mocking Fundamentals on TestingJavaScript.com

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Js Mocking Fundamentals

Duckrails
Development tool to mock API endpoints quickly and easily (docker image available)
Stars: ✭ 1,690 (+828.57%)
Mutual labels:  mocking
Prism
Turn any OpenAPI2/3 and Postman Collection file into an API server with mocking, transformations and validations.
Stars: ✭ 2,484 (+1264.84%)
Mutual labels:  mocking
Dom Testing Library With Anything
Use DOM Testing Library to test any JS framework on TestingJavaScript.com
Stars: ✭ 177 (-2.75%)
Mutual labels:  kcd-edu
Hoverfly
Lightweight service virtualization/API simulation tool for developers and testers
Stars: ✭ 1,814 (+896.7%)
Mutual labels:  mocking
Httpmocker
HttpMocker is a simple HTTP mocking library written in Kotlin to quickly and easily handle offline modes in your apps
Stars: ✭ 155 (-14.84%)
Mutual labels:  mocking
Mockito
Most popular Mocking framework for unit tests written in Java
Stars: ✭ 12,453 (+6742.31%)
Mutual labels:  mocking
Spy
Clojure/ClojureScript library for stubs, spies and mocks.
Stars: ✭ 131 (-28.02%)
Mutual labels:  mocking
Ioredis Mock
Emulates ioredis by performing all operations in-memory.
Stars: ✭ 181 (-0.55%)
Mutual labels:  mocking
Dingo
🐺 Easy, fast and type-safe dependency injection for Go.
Stars: ✭ 154 (-15.38%)
Mutual labels:  mocking
Mocktail
A mock library for Dart inspired by mockito
Stars: ✭ 172 (-5.49%)
Mutual labels:  mocking
Static Testing Tools
Static Analysis Testing JavaScript Applications on TestingJavaScript.com
Stars: ✭ 141 (-22.53%)
Mutual labels:  kcd-edu
Castlemock
Castle Mock is a web application that provides the functionality to mock out RESTful APIs and SOAP web services.
Stars: ✭ 153 (-15.93%)
Mutual labels:  mocking
Examples
Examples of Mock Service Worker usage with various frameworks and libraries.
Stars: ✭ 163 (-10.44%)
Mutual labels:  mocking
Mockbin
Mock, Test & Track HTTP Requests and Response for Microservices
Stars: ✭ 1,782 (+879.12%)
Mutual labels:  mocking
Mocktopus
Mocking framework for Rust
Stars: ✭ 179 (-1.65%)
Mutual labels:  mocking
Fauxhai
Easily mock full ohai data
Stars: ✭ 134 (-26.37%)
Mutual labels:  mocking
Httpretty
Intercept HTTP requests at the Python socket level. Fakes the whole socket module
Stars: ✭ 1,930 (+960.44%)
Mutual labels:  mocking
Respx
Mock HTTPX with awesome request patterns and response side effects 🦋
Stars: ✭ 183 (+0.55%)
Mutual labels:  mocking
Xamarin.forms.mocks
Library for running Xamarin.Forms inside of unit tests
Stars: ✭ 179 (-1.65%)
Mutual labels:  mocking
Vcrpy
Automatically mock your HTTP interactions to simplify and speed up testing
Stars: ✭ 2,144 (+1078.02%)
Mutual labels:  mocking

JavaScript Mocking Fundamentals


Learn how mocking in JavaScript tests works by implementing them from scratch!


In this material, we have a set of no-framework tests that correspond to a set of jest tests (in the __tests__ directory). The idea is that (with the exception of the first test), you look at the jest version first, then see how that would be implemented without a testing framework.

Order of material:

  1. monkey-patching.js (no jest version)
  2. mock-fn.js
  3. spy.js
  4. inline-module-mock.js
  5. external-mock-module.js

The files are intended to test the thumb-war.js module and mock the utils module.

To run the tests, run npx jest. To start watch mode run npx jest --watch

Custom jest runner.

You can definitely run the no-framework files just using node (like this: node src/no-framework/monkey-patching.js), but in an effort to make running these easier, I created a custom jest runner that uses jest to run the files, but allow them to be run without the jest testing framework. It's really cool. It uses create-jest-runner and should probably be published eventually.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].