Socket
Book a DemoInstallSign in
Socket

stubo

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stubo

A simple JavaScript stubbing library.

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

stubo

stubo (pronounced stub-oh) is a simple JavaScript stubbing component. It's useful for creating stub objects for AngularJS tests or proxyquire tests.

Why not Sinon?

Sinon is a great library that supports stubbing. But unfortunately it only supports stubbing one level deep.

Installation

npm i --save stubo

Example

stubo converts this:

var stub = {
  window: {
    localStorage: {
      getItem: function () {
        return 'data'
      },
      length: 1
    }
  }
}

to this:

var stubo = require('stubo')
var stub = {}
stubo(stub, 'window', 'localStorage.getItem()', 'data')
stubo(stub, 'window', 'localStorage.length', 1)

License

MIT

Keywords

test

FAQs

Package last updated on 28 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts