npm msw 0.27.0

latest releases: 2.6.0, 2.5.2, 2.5.1...
3 years ago

Breaking changes

  • The Promise returned by worker.start() will now reject in the case of any errors during the worker registration (#607).
  • The library no longer exports the following TypeScript declarations:
    • RestRequestType, use RestRequest instead.
    • GraphQLMockedRequest, use GraphQLRequest instead.
    • GraphQLMockedContext, use GraphQLContext instead.
    • GraphQLRequestPayload, use GraphQLRequestBody instead.
    • GraphQLRequestParsedResult, use ParsedGraphQLRequest instead.
    • GraphQLResponseResolver
  • The values of the MockedRequest type no longer have the params key (#561). Please use the RestRequest type to annotate REST API requests instead.

Features

  • Supports automatic worker script updates (#606). Respects the msw.workerDirectory property in your package.json:
{
  "msw": {
    "workerDirectory": "public"
  }
}

Starting from this release, whenever you install msw, it will try to locate the msw.workerDirectory property in your package.json and copy the relevant worker script (mockServiceWorker.js) to that directory.

Whenever running msw init now, you will be prompted to save your public directory choice to package.json.

  • When running msw init you can pass the —save option to automatically save the public directory in your package.json for future worker updates (#606). You can alternatively use --no-save to bail out this step.
  • Intercepts requests originating from an iframe (#589).
  • Adds virtual cookie store to ensure the persistency of cookies received from the same domains across multiple requests (#435, #469).

Bug fixes

  • Fixes an issue when a request body type generic had no effect on the response composition chain validation.
  • Fixes an issue when a 204 response threw an exception when the library emitted its response:* life-cycle events (#570).

Internal

  • Rebuilds the Request Handler API from ground-up (#561). Does not introduce any breaking changes in how you use the handlers.
  • Fixes the auto-imports of the library’s methods suggested by IDE (#598).
  • Updates the dependencies.

Don't miss a new msw release

NewReleases is sending notifications on new releases.