Seamless REST/GraphQL API mocking library for browser and Node.js.
MIT License
Bot releases are hidden (Show)
SyntaxError: Invalid regular expression: invalid group specifier name
exception in Safari and Firefox due to the usage of a negative lookbehind token in RegExp internally (#142, #143)This release introduces change to the service worker file. Please follow the instructions in your browser's console to update the worker file in your project. Thank you.
ctx.delay()
not delaying the mocked response (#136, 137)npx msw init
command (#130, #131)composeMocks()
function is deprecated. Please use the setupWorker()
function instead:- import { composeMocks, rest } from 'msw'
+ import { setupWorker, rest } from 'msw'
- const { start } = composeMocks(...)
+ const { start } = setupWorker(...)
This release bumps the integrity of
mockServiceWorker.js
. Please follow the error instructions in your browser's console to update the worker file to the latest version.
start()
function now accepts an options object:- start('./custom/sw/path.js', { ... })
+ start({ serviceWorker: { url: './custom/sw/path.js', options: { ... } })
start
function now support a quiet
option, allowing to opt-out from the logs in browser's console (#111, #113)start({ quiet: true })
msw
throwing a type violation when used with TypeScript v3.7 (unsupported export * as
syntax) (#114, #117, ).ramda
dependency.This release introduces changes to
mockServiceWorker.js
file. Upon updating, you will be asked to update your Service Worker file. Please follow the instructions in the browser’s console to update the file.
ctx.cookie()
(#101, #103).rest.post('/login', (req, res, ctx) => {
return res(
ctx.cookie('auth-token', 'abc-123')
)
})
This change would bump the integrity of the Service Worker. Please follow the instructions in the respective error message in your browser's console to update the Service Worker file.
This release introduces changes to the
mockServiceWorker.js
file. You will be advised to update that file in your application. Please follow the instructions in the related error message in your browser's console.
start()
function would resolve sooner than the Service Worker enabled the mocking (#73, #90)This release introduces changes to the
mockServiceWorker.js
file. You will be advised to update that file in your application. Please follow the instructions in the related error message in your browser's console.
POST
request performed a GET
request instead (#77, #84)Published by kettanaito over 4 years ago
req
object now contains new properties: integrity
, destination
, keepalive
, bodyUsed
req.params
being null
, causing an exception when trying to access an existing parameterstart()
and stop()
functions now returns a Promise that corresponds to the Service Worker registration/unregistration statusimport { composeMocks, rest } from 'msw'
const { start, stop } = composeMocks(
rest.get(...)
)
start.then(() => {/* Your logic here */})
stop.then(() => {/* Your logic here */})