Fixes:
- Fixes the adding of erroneous response codes for certain endpoints.
- Fixes transformations when multiple endpoints are used.
Features:
- Removes
useInProduction
.
Features:
- Adds
unmock-xmlhttprequest
.
Fixes:
- Fix import type error that made Unmock fail to compile
Features:
- Add programmatic
Faker API
for creating and managing services - Add
stop
command tounmock-server
- Extract
runner
fromunmock-core
- Add new
unmock-runner
package withjestRunner
for Jest configuration
Fixes:
- Fixed bug in
unmock-server
CLI by includingoclif.manifest.json
in the package.
Features:
- Updated packages to fix security vulnerabilities
Features:
- Add CLI to
unmock-server
- Add
unmock-browser
package, which runsunmock-js
in browser and React Native - Implement parsing of request headers in
unmock-fetch
- Add
unmock-types
package - Extract
UnmockFaker
class fromBackend
class - Rename
unmock.newFaker()
tounmock.faker()
Fixes:
- Remove
concurrently
dependency
Features:
- Add
unmock-server
, a mock server - Add
unmock.randomize.on()
option for randomizing responses - Introduce
unmock
CLI inunmock-cli
package
Features:
- Extract
unmock-node
fromunmock-core
for better portability to other environments - Add
unmock-fetch
package
Features:
- Request and response include
bodyAsJson
for convenient access to a parsed object - Include request headers in Jest reporter and redact
Authorization
fields - Adds
u.opt
Fixes:
- Fix missing Faker issue #272
- Adds certain types as a dependency
Fixes:
- Fixes a bug in the reporter where no test suites were shown
Fixes:
- fixes a bug where path parameters were incorrectly matched if they were anything other than a string.
Features:
- the
runner
no longer needs manual resetting of the spies
Fixes:
json-schema-faker
ignoredminItems
, which is now disabled. as a result, there is a slight regression in the fuzzing (it is less fuzzy) that we can address in a future release.
Features:
nock
-like syntax for setting request headers, response headers, request bodies, and queries
Features:
- Added more randomization to test runner
- Added more accessors to spy methods, for example,
postResponseCode
- Added
unmock.associate
method for associating a service with a URL - Changed Jest reporter to show only one test suite at a time
Features:
- Added
mapDefaultTo
to the transformer in order to map a default OpenAPI response to another code. - Made it possible for JSON schema objects created by
u
to contain plain JSON objects that will be turned into constants.
Fixes:
- Made prettier work in each repo of the monorepo, resulting in a lot of changes. The whole thing is more readable now.
Breaking changes:
- Renamed
unmock.gen
package asunmock.transform
- Renamed
unmock.transform.<method>.address
package asunmock.transform.<method>.lens
Features:
- New state mananagement system using
monocle-ts
and functional programming conventions. To set the state of any service, you use a function that accepts a request and an OpenAPI schema and returns a modified schema. - A new runner for fuzz testing.
Fixes:
- Disabled
esModuleInterop
intsconfig.json
so that the package can be used withoutesModuleInterop
Features:
- Added initial
nock
-like syntax for declaring services - Added
unmock-jest
package for Unmock Jest reporter - Added snapshotting of requests to local disk so they're available for the Jest reporter
Breaking changes:
- Renamed
unmock-node
package asunmock
Fixes:
- Added the missing SinonJS types
- Fixed setting state using reserved OpenAPI schema keywords such as
type
Features:
- Added
pathname
andquery
request object - Added spy helpers such as
postResponseBody
Breaking changes:
unmock.on()
returnsthis
instead ofstates
object.- Deleted
unmock.states
: state changes should be done viaunmock.services["service"].state
Features:
- Exports
UnmockRequest
,UnmockResponse
and other exposed types - Adds service spy for keeping track of service calls
- Exports
sinon
for easy assertions on service spy
Fixes:
- Remove polyfills polluting global scope
Fixes:
- Add missing core-js dependency to packages
Features:
- Package compilation with Babel to support Node.js >= 6
- Better formatting for error messages
- Read services from
node_modules/@unmock
in addition to__unmock__
Features:
- Export types
Request
andStates
- Add typing to
states
object
Fixes:
- Fix issue in Node<10 where
URL
was used without it being available
Features:
- Add
allowedHosts
object tounmock
to add new allowed hosts - Add flaky mode with
unmock.flaky.on()
- Add better error messages when no matching operation is found from the specification
- Allow changing service state with functions taking the request as an argument
Fixes:
- Fix bugs in loas3 in handling references
Fix:
dist/
directory was missing from the release because of a bug in the CI/CD pipeline #107
Features:
- Setting states is now a typed experience. Hints on how to use the state facade object are available -> ba6a78f.
- As services are dynamically loaded, hints for available services do not show up. You may use the services dynamically as usual though.
textResponse
is now infered automatically when setting a state with a string -> bd9ac1- If you need to specify additional DSL instructions, you still need to use
textResponse
.
- If you need to specify additional DSL instructions, you still need to use
Fix:
- Dereferencing JSON
$ref
instructions only happens when needed (setting a state) -> 36cf981- Dereferencing certain services took long otherwise and was redundant work.
- For the time being, only dereferences internal references and references to local files.
- Renames
textMW
transformer totextResponse
-> 3c43358 - Import notation no longer requires an asterisk (
import unmock from "unmock-node"
) -> cdd46ee middleware
renamed todsl
, withobjResponse
as a named export instead of the default (import { dsl } from "unmock-node"
) -> cdd46ee
Bugfixes:
- Replace server path prefix (terminated with a
/
) with/
, instead of removing the non-terminated path prefix -> 30083e5- When a service path prefix and an endpoint shared the same prefix, setting a state would break (e.g. consider Slack's
/api/
service prefix and/api.test
endpoint).
- When a service path prefix and an endpoint shared the same prefix, setting a state would break (e.g. consider Slack's
Bugfixes:
- Generator no longer uses the default values for consecutive generation calls -> 30e1519
- The use of default values is set for header generation and was not cancelled before body generation.
Features:
- Resolve JSON
$ref
when loading a service -> 8cff0bf
Bugfixes:
- If the
required
field is not stated in the response specification, automatically generate all the fields in the matching response. If it is present, randomly select which additional fields to generate -> a414f89
Initial release.
Features:
- (OpenAPI) Specification-based automatic mocking system.
- Interception of requests with a NodeJS backend client - your test code requests won't reach 3rd party APIs by mistake!
- Basic options to control whitelisted URLs (supports wildcards and regular expressions).
- State management system (user may supply their own values to generate matching responses from the specification).
- Users may set states with object notation (
{ users: { social: { facebook: "facebook_id" }}}
) and textual responses (forplain/text
endpoints) usingtextResponse
(textResponse("foobar")
). These are found under the exportedmiddleware
object. Refer to documentation for more examples and clarification. - Fluent API access to set the states, supporting wildcard matches, REST methods, custom service names, etc.
- States are applied to endpoints for which they are valid. If no endpoint is specified, all endpoints and all REST methods are checked for the given state.
- Runtime error for mismatching values, attempting to set states for non-existing endpoints, etc.
- Users may set states with object notation (
- Basic unmock DSL to allow fine-tuned modification of mocked responses ("states").
$code
(to specify response status code),$times
(to specify number of times a state is valid) and$size
(to specify the size of an array).
- Boilerplate code for future expansion into
jsdom
and futureCLI
support.