Releases: theKashey/rewiremock
Releases · theKashey/rewiremock
mockThrough
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%
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
Now your mocks are protected by TypeScript or Flow's type safety.
You will always mock the things you wanna mock.
Webpack + Proxyquire API
Rewiremock API is quite simply, and quite right
. But sometimes it is overpower, and you need something simpler.
Introducing the new methods:
- rewiremock.proxy(file, stubs) – proxyquire style command, but stubs can be a function(to use rewiremock mock API inside)
- 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
1.3.6 - directChildOnly
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
Fixed:
- in case you use
callThought
withisolation
- mocked module will be treated aspassBy
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.