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

mocha-mix

v1.1.0

Published

An easy way to test and mock your React Components

Readme

mocha-mix

npm version Build Status bitHound Score Dependency Status devDependency Status peerDependency Status Code Climate Test Coverage

mocha-mix started as a out-of-box unit testing tool for ReactJS. It focuses more toward providing interface for creating easy mocking and testing scope isolation.

Install

npm install --save-dev mocha-mix

Plugins

  • mocha-mix-jsdom: Exposes window and document to global scope. Useful to test React using mocha.
  • mocha-mix-jsdom-3: mocha-mix-jsdom using [email protected]. Useful for those who uses [email protected] or lower.
  • mocha-mix-react: Provides helpful default mock generator for React unit testing.
  • mocha-mix-react.0.13: mocha-mix-react using [email protected]
  • mocha-mix-mockery: Uses mockery as mock engine.
  • mocha-mix-jest: Uses jest as mock engine. (In progress)
  • mocha-mix-jasmine: Provides test hooks getter for jasmine. (In progress)

API References

MochaMix

mix

Returns a new Mixer with given recipe object.

mix(recipe: Recipe): Mixer

use

Takes given functional argument as a plugin.

use(plugin: Function): void

setTestHooksGetter

Replaces a testHookGetter with given getter Function.

setTestHooksGetter(getter: Function): void

setDefaultMockGenerator

Replaces a defaultMockGenerator with given generator function

setDefaultMockGenerator(generator: Function or MockGenerator): void

before

Registers given function as beforeAll hook

before(hook: Function or MixHook): void

before

Registers given function as beforeAll hook

before(hook: Function or MixHook): void

beforeEach

Registers given function as beforeEach hook

beforeEach(hook: Function or MixHook): void

afterEach

Registers given function as afterEach hook

afterEach(hook: Function or MixHook): void

after

Registers given function as after hook

after(hook: Function or MixHook): void

clearHook

clears all registered named hooks with given hookName

clearHook(hookName: string): void

clearAllHooks

clears all registered hooks

clearAllHooks(void): void

MockGenerator

Returns a function which wraps the given function. In testing runtime, MockDescription instance will be passed down to the generator for further customization.

MockGenerator(generator: Function): GeneratorWrapper

MixHook

Returns a function which wraps the given test hook function.

MixHook(hook: Function): Wrapper

MixPlugin

Returns a function if the given plugin function is valid.

MixPlugin(plugin: Function): Function

Mixer

Returns mixer instance.

Mixer(MixRecipe): Mixer

import

Returns a default module. Follows ES6 Module standard.

import(void): Any

require

Returns a module using commonJS pattern.

require(void): Any

importAsWildcard

Returns a module as wildcard import. Follows ES6 Module standard.

registerMocks

Registers mock reference so that in can be referenced in a test scope.

registerMock(name: String, mock: Any): void

clearMock

Clears a mock reference with given name reference.

clearMock(name: String): void

clearAllMocks

Clears all mock references

clearAllMocks(void): void

MixRecipe

MixRecipe is a guide object.

rootDir

rootDir: string defaults: process.cwd()