npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ezmock-firestore

v1.2.5

Published

Quick and simple mocking support for firestore

Readme

ezmock-firestore

The ezmock-firestore is a lightweight implementation of the Firebase/Firestore apis designed to run locally and store data in memory without any external dependencies or connections to a real Firestore database. Its primary purpose is to support Unit testing of libraries that depend on Firestore.

Getting Started

const firebase = require('ezmock-firebase);

// Get a Firestore instance
const db = firebase.firestore();

Prepopulating Data for Tests

If you want to preload data for your tests you use preload in the before hook of your test suite. The first parameter is the model to load and the second one is the data.

const firebase = require('ezmock-firebase);
const db = firebase.firestore();
const data = []; // an array of people that can be loaded from a file as well.

db.preload('People', data);

Works with subcollections as well

const firebase = require('ezmock-firebase);
const db = firebase.firestore();
const cardData = []; // an array of card data for that specific subcollection.

db.preload('People/id101/cards', cardData)

To set a specific id for the preloaded data, set the __id property with the ID to be used. If not given, an auto id will be generated

With customm ids

const data = [{
  name: 'John Doe',
  __id: 'mycustomID,
}]

db.preload('People', data);

// This equals to
db.doc('People/mycustomID').set({

});

Also you simply do a firebase add or set

const firebase = require('ezmock-firebase);
const db = firebase.firestore()

await db.collection('Address').add({
  street1: '2480 Precision Dr'
  street2: 'STE K',
  city: 'Minden',
  state: 'NV',
  zipcode: '89423'
})

Clear Data

To clear data for all of the models, call the flush method. Remember the data you add and update in the collections remains until the test suite ends or you call flush explicitly.

const firebase = require('ezmock-firebase);
const db = firebase.firestore();

db.flush();

If you want to clear a specific model, you can pass it as a parameter

db.flush('People');

Works with subcollections as well

db.flush('People/id0101/cards');