[AskJS] Can we talk about Stubs, Spies and Mocks in JavaScript and what a mess they are?

This page summarizes the projects mentioned and recommended in the original post on /r/javascript

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • TypeScript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • I don't know a lot of languages that are being taken over by a superset.

  • msw

    Seamless REST/GraphQL API mocking library for browser and Node.js.

  • Rather than mocking fetch you could use mws https://mswjs.io/. We have an implementation around it and it's made our tests pretty nice. We have default implementations for every API call that generally just return static data. So in a test if I need the projects and usage apis for a view I can just do mockServer.mockRequests('getProjects', 'getUsage') (that's our implementation not quite how MSW works out of the box, but it's a great tool).

  • 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 logo
  • NSubstitute

    A friendly substitute for .NET mocking libraries.

  • ts-ebml

    EBML encoder and decoder (by guest271314)

  • If necessary I will convert the code to JavaScript from TypeScript https://github.com/guest271314/ts-ebml/blob/a7ec9ddd54c2ff7ae7c0d3656864d0388eda238b/lib/ts-ebml-min.js.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts