New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@alexp643/stu

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

@alexp643/stu

Stub dependencies when testing

  • 4.0.0-beta.0
  • beta
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

Stu

A shoddy replacement for jest that works with mocha and sinon but is way faster.

Basically it allows you to stub entire modules that are required by the file you are testing.

Installation

npm install --save-dev stu

Usage

import test from 'ava';
import * as stu from 'stu';

test.beforeEach((t) => {
  t.context = {
    ...t.context,
    library: stu.mock('library'),
    mycode: stu.test('../mycode').default
  };
})

test('should do stuff with thing', (t) => {
    const { library, mycode } = t.context;

  library.returns('some value');
  mycode();
  t.deepEqual(library.args, [['a', 'b', 'c']]);
});

Keywords

FAQs

Package last updated on 01 Nov 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc