Skip to content

Releases: theKashey/rewiremock

mockThrough

01 Mar 04:57
Compare
Choose a tag to compare

I always like this feature in Jest - just mock dependency, and that's all.

Features

  • mock.mockThrough - automatically mock all functions in a file.
  • plugin.mockThroughByDefault - enable this behavior by defalt

Better caching and %everything%

08 Dec 06:22
Compare
Choose a tag to compare

Actually, this is a huge update.

  • type comparison not only for TS/Flow, but also for normal JS files.
  • Jest support.
  • Way better caching strategy.
  • Some scope-based issues were fixed.

At your service.

Type-safety. And async mocks

18 Nov 09:24
Compare
Choose a tag to compare

Now your mocks are protected by TypeScript or Flow's type safety.
You will always mock the things you wanna mock.

Webpack + Proxyquire API

02 Oct 07:44
Compare
Choose a tag to compare

Rewiremock API is quite simply, and quite right. But sometimes it is overpower, and you need something simpler.
Introducing the new methods:

  1. rewiremock.proxy(file, stubs) – proxyquire style command, but stubs can be a function(to use rewiremock mock API inside)
  2. rewiremock.module(fileLoader, stubs) - the same function, but you will provide a require/import function by your own.

And, last but not least - rewiremock now supporting webpack.

2.0.0

23 Aug 21:59
Compare
Choose a tag to compare

Breaking change :(
Renaming callThought -> callThrough.

1.3.6 - directChildOnly

25 Jul 12:55
Compare
Choose a tag to compare

Sometimes you have to mock only directly used modules, or direct children. It was possible with relative plugin, but it was not flexible.

New API:

  rewiremock('somemodule')
     .with(stub)
     .directChildOnly()

As result somemodule will be mocked only as a top level dependency. If not - no mocking will occurs.

v 1.3.5

24 Jul 22:36
Compare
Choose a tag to compare

Fixed:

  • in case you use callThought with isolation - mocked module will be treated as passBy automagicly. In other words - if parent of a module is listed as a mock(or as a passBy) - it will not bypass isolation.

Added:

  • isolation got options as argument. First, and the only one,- noAutoPassBy to switch of behaviour or the last change. Strict isolation is a useful thing.