github mswjs/msw v0.30.0

latest releases: v2.4.9, v2.4.8, v2.4.7...
3 years ago

Features

  • Supports generators as response resolvers (#720).
rest.get('/polling/:maxCount', function* (req, res, ctx) {
  const { count } = req.params
	let count = 0

	while (count < req.params. maxCount) {
	  yield res(ctx.json({ count }))
	}

	return res(ctx.json({ done: true }))
})
  • Adds the ctx.cookie utility to the GraphQL handlers (#763).
  • Adds a warning when running MSW on a page that’s outside of the worker’s scope (#787).
  • The worker script (mockServiceWorker.js) now contains the library version number to improve its inspection and debugging across releases (#781).

Bug fixes

  • Fixes various issues to ensure Jest 27 compatibility.
  • Fixes an issue that prevented the assignment of more narrow response types (#735).
  • Fixes an issue when parsing a GraphQL-compatible REST API request produced a parsing error during the onUnhandledRequest default behavior (#740).

Don't miss a new msw release

NewReleases is sending notifications on new releases.