@alexp643/stu
TypeScript icon, indicating that this package has built-in type declarations

4.0.0-beta.0 • Public • Published

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']]);
});

Dependencies (3)

Dev Dependencies (3)

Package Sidebar

Install

npm i @alexp643/stu

Weekly Downloads

3

Version

4.0.0-beta.0

License

MIT

Unpacked Size

581 kB

Total Files

39

Last publish

Collaborators

  • alexp643