v0.8 introduces many improvements to the exported Zimic modules.
General resources were kept in zimic.
General HTTP resources were moved to zimic/http.
HTTP interceptor resources were moved from zimic/interceptor to zimic/interceptor/http.
HTTP interceptor server resources were moved from zimic/server to zimic/interceptor/server.
A summary of the changes is shown below:
Summary of changes to zimic
Resource
(v0.7) Previously exported from
(v0.8) Now exported from
type HttpBody
zimic
zimic/http
type HttpRequest
zimic
zimic/http
type HttpResponse
zimic
zimic/http
HttpSearchParams
zimic
zimic/http
type HttpSearchParamsInit
zimic
zimic/http
type HttpSearchParamsSchema
zimic
zimic/http
type HttpSearchParamsSchemaTuple
zimic
zimic/http
type StrictURLSearchParams
zimic
zimic/http
HttpHeaders
zimic
zimic/http
type HttpHeadersInit
zimic
zimic/http
type HttpHeadersSchema
zimic
zimic/http
type HttpHeadersSchemaTuple
zimic
zimic/http
type StrictHeaders
zimic
zimic/http
HttpFormData
zimic
zimic/http
type HttpFormDataSchema
zimic
zimic/http
type StrictFormData
zimic
zimic/http
type HttpSchema
zimic
zimic/http
type HttpMethod
zimic
zimic/http
type HttpServiceSchema
zimic
zimic/http
type HttpServiceMethodsSchema
zimic
zimic/http
type HttpServiceMethodSchema
zimic
zimic/http
type HttpServiceRequestSchema
zimic
zimic/http
type HttpServiceResponseSchemaByStatusCode
zimic
zimic/http
type HttpServiceResponseSchema
zimic
zimic/http
type HttpServiceResponseSchemaStatusCode
zimic
zimic/http
type HttpServiceSchemaMethod
zimic
zimic/http
type HttpServiceSchemaPath
zimic
zimic/http
type LiteralHttpServiceSchemaPath
zimic
zimic/http
type NonLiteralHttpServiceSchemaPath
zimic
zimic/http
type PathParamsSchemaFromPath
zimic
zimic/http
InvalidFormDataError
zimic
zimic/http
Summary of changes to zimic/interceptor
http was renamed to httpInterceptor and is now exported from zimic/interceptor/http.
Resource
(v0.7) Previously exported from
(v0.8) Now exported from
http
zimic/interceptor
zimic/interceptor/http as httpInterceptor
type HttpInterceptorNamespace
zimic/interceptor
zimic/interceptor/http
type HttpInterceptorNamespaceDefault
zimic/interceptor
zimic/interceptor/http
type HttpInterceptor
zimic/interceptor
zimic/interceptor/http
type LocalHttpInterceptor
zimic/interceptor
zimic/interceptor/http
type RemoteHttpInterceptor
zimic/interceptor
zimic/interceptor/http
type HttpInterceptorPlatform
zimic/interceptor
zimic/interceptor/http
type HttpInterceptorType
zimic/interceptor
zimic/interceptor/http
type HttpInterceptorOptions
zimic/interceptor
zimic/interceptor/http
type LocalHttpInterceptorOptions
zimic/interceptor
zimic/interceptor/http
type RemoteHttpInterceptorOptions
zimic/interceptor
zimic/interceptor/http
type UnhandledRequestStrategy
zimic/interceptor
zimic/interceptor/http
type ExtractHttpInterceptorSchema
zimic/interceptor
zimic/interceptor/http
type HttpInterceptorRequest
zimic/interceptor
zimic/interceptor/http
type HttpInterceptorResponse
zimic/interceptor
zimic/interceptor/http
type TrackedHttpInterceptorRequest
zimic/interceptor
zimic/interceptor/http
type HttpRequestHandler
zimic/interceptor
zimic/interceptor/http
type LocalHttpRequestHandler
zimic/interceptor
zimic/interceptor/http
type RemoteHttpRequestHandler
zimic/interceptor
zimic/interceptor/http
type SyncedRemoteHttpRequestHandler
zimic/interceptor
zimic/interceptor/http
type PendingRemoteHttpRequestHandler
zimic/interceptor
zimic/interceptor/http
type HttpRequestHandlerResponseDeclaration
zimic/interceptor
zimic/interceptor/http
type HttpRequestHandlerResponseDeclarationFactory
zimic/interceptor
zimic/interceptor/http
type HttpRequestHandlerRestriction
zimic/interceptor
zimic/interceptor/http
type HttpRequestHandlerComputedRestriction
zimic/interceptor
zimic/interceptor/http
type HttpRequestHandlerHeadersStaticRestriction
zimic/interceptor
zimic/interceptor/http
type HttpRequestHandlerSearchParamsStaticRestriction
zimic/interceptor
zimic/interceptor/http
type HttpRequestHandlerStaticRestriction
zimic/interceptor
zimic/interceptor/http
type HttpRequestHandlerBodyStaticRestriction
zimic/interceptor
zimic/interceptor/http
UnknownHttpInterceptorPlatformError
zimic/interceptor
zimic/interceptor/http
UnknownHttpInterceptorTypeError
zimic/interceptor
zimic/interceptor/http
NotStartedHttpInterceptorError
zimic/interceptor
zimic/interceptor/http
UnregisteredBrowserServiceWorkerError
zimic/interceptor
zimic/interceptor/http
DisabledRequestSavingError
zimic/interceptor
zimic/interceptor/http
Summary of changes to zimic/server
createInterceptorServer is now part of the namespace interceptorServer, exported from zimic/interceptor/server, and can be access via interceptorServer.create.
runCommand and CommandError were removed.
Resource
(v0.7) Previously exported from
(v0.8) Now exported from
createInterceptorServer
zimic/server
zimic/interceptor/server as interceptorServer.create
InterceptorServer
zimic/server
zimic/interceptor/server
InterceptorServerOptions
zimic/server
zimic/interceptor/server
NotStartedInterceptorServerError
zimic/server
zimic/interceptor/server
runCommand
zimic/server
[removed]
CommandError
zimic/server
[removed]
DEFAULT_ACCESS_CONTROL_HEADERS
zimic/server
zimic/interceptor/server
DEFAULT_PREFLIGHT_STATUS_CODE
zimic/server
zimic/interceptor/server
3. Migrate from runCommand and CommandError
runCommand and CommandError were removed, mainly because:
Zimic is not focused on running commands, so exporting runCommand did not make sense for Zimic's goal.
runCommand and CommandError are not tied in any way to interceptor servers, so those utilities did not belong to zimic/interceptor/server.
There are better alternatives to runCommand, especially execa and cross-spawn.
If you used runCommand before v0.8, execa is a great alternative. For example:
Migration guide: v0.8.0
1. Install the latest Zimic version
npm install zimic@latest --save-dev
pnpm add zimic@latest --dev
yarn add zimic@latest --dev
bun add zimic@latest --dev
2. Change imports to the new structure
v0.8 introduces many improvements to the exported Zimic modules.
zimic
.zimic/http
.zimic/interceptor
tozimic/interceptor/http
.zimic/server
tozimic/interceptor/server
.A summary of the changes is shown below:
Summary of changes to
zimic
v0.7
) Previously exported fromv0.8
) Now exported fromHttpBody
zimic
zimic/http
HttpRequest
zimic
zimic/http
HttpResponse
zimic
zimic/http
HttpSearchParams
zimic
zimic/http
HttpSearchParamsInit
zimic
zimic/http
HttpSearchParamsSchema
zimic
zimic/http
HttpSearchParamsSchemaTuple
zimic
zimic/http
StrictURLSearchParams
zimic
zimic/http
HttpHeaders
zimic
zimic/http
HttpHeadersInit
zimic
zimic/http
HttpHeadersSchema
zimic
zimic/http
HttpHeadersSchemaTuple
zimic
zimic/http
StrictHeaders
zimic
zimic/http
HttpFormData
zimic
zimic/http
HttpFormDataSchema
zimic
zimic/http
StrictFormData
zimic
zimic/http
HttpSchema
zimic
zimic/http
HttpMethod
zimic
zimic/http
HttpServiceSchema
zimic
zimic/http
HttpServiceMethodsSchema
zimic
zimic/http
HttpServiceMethodSchema
zimic
zimic/http
HttpServiceRequestSchema
zimic
zimic/http
HttpServiceResponseSchemaByStatusCode
zimic
zimic/http
HttpServiceResponseSchema
zimic
zimic/http
HttpServiceResponseSchemaStatusCode
zimic
zimic/http
HttpServiceSchemaMethod
zimic
zimic/http
HttpServiceSchemaPath
zimic
zimic/http
LiteralHttpServiceSchemaPath
zimic
zimic/http
NonLiteralHttpServiceSchemaPath
zimic
zimic/http
PathParamsSchemaFromPath
zimic
zimic/http
InvalidFormDataError
zimic
zimic/http
Summary of changes to
zimic/interceptor
http
was renamed tohttpInterceptor
and is now exported fromzimic/interceptor/http
.v0.7
) Previously exported fromv0.8
) Now exported fromhttp
zimic/interceptor
zimic/interceptor/http
ashttpInterceptor
HttpInterceptorNamespace
zimic/interceptor
zimic/interceptor/http
HttpInterceptorNamespaceDefault
zimic/interceptor
zimic/interceptor/http
HttpInterceptor
zimic/interceptor
zimic/interceptor/http
LocalHttpInterceptor
zimic/interceptor
zimic/interceptor/http
RemoteHttpInterceptor
zimic/interceptor
zimic/interceptor/http
HttpInterceptorPlatform
zimic/interceptor
zimic/interceptor/http
HttpInterceptorType
zimic/interceptor
zimic/interceptor/http
HttpInterceptorOptions
zimic/interceptor
zimic/interceptor/http
LocalHttpInterceptorOptions
zimic/interceptor
zimic/interceptor/http
RemoteHttpInterceptorOptions
zimic/interceptor
zimic/interceptor/http
UnhandledRequestStrategy
zimic/interceptor
zimic/interceptor/http
ExtractHttpInterceptorSchema
zimic/interceptor
zimic/interceptor/http
HttpInterceptorRequest
zimic/interceptor
zimic/interceptor/http
HttpInterceptorResponse
zimic/interceptor
zimic/interceptor/http
TrackedHttpInterceptorRequest
zimic/interceptor
zimic/interceptor/http
HttpRequestHandler
zimic/interceptor
zimic/interceptor/http
LocalHttpRequestHandler
zimic/interceptor
zimic/interceptor/http
RemoteHttpRequestHandler
zimic/interceptor
zimic/interceptor/http
SyncedRemoteHttpRequestHandler
zimic/interceptor
zimic/interceptor/http
PendingRemoteHttpRequestHandler
zimic/interceptor
zimic/interceptor/http
HttpRequestHandlerResponseDeclaration
zimic/interceptor
zimic/interceptor/http
HttpRequestHandlerResponseDeclarationFactory
zimic/interceptor
zimic/interceptor/http
HttpRequestHandlerRestriction
zimic/interceptor
zimic/interceptor/http
HttpRequestHandlerComputedRestriction
zimic/interceptor
zimic/interceptor/http
HttpRequestHandlerHeadersStaticRestriction
zimic/interceptor
zimic/interceptor/http
HttpRequestHandlerSearchParamsStaticRestriction
zimic/interceptor
zimic/interceptor/http
HttpRequestHandlerStaticRestriction
zimic/interceptor
zimic/interceptor/http
HttpRequestHandlerBodyStaticRestriction
zimic/interceptor
zimic/interceptor/http
UnknownHttpInterceptorPlatformError
zimic/interceptor
zimic/interceptor/http
UnknownHttpInterceptorTypeError
zimic/interceptor
zimic/interceptor/http
NotStartedHttpInterceptorError
zimic/interceptor
zimic/interceptor/http
UnregisteredBrowserServiceWorkerError
zimic/interceptor
zimic/interceptor/http
DisabledRequestSavingError
zimic/interceptor
zimic/interceptor/http
Summary of changes to
zimic/server
createInterceptorServer
is now part of the namespaceinterceptorServer
, exported fromzimic/interceptor/server
, and can be access viainterceptorServer.create
.runCommand
andCommandError
were removed.v0.7
) Previously exported fromv0.8
) Now exported fromcreateInterceptorServer
zimic/server
zimic/interceptor/server
asinterceptorServer.create
InterceptorServer
zimic/server
zimic/interceptor/server
InterceptorServerOptions
zimic/server
zimic/interceptor/server
NotStartedInterceptorServerError
zimic/server
zimic/interceptor/server
runCommand
zimic/server
CommandError
zimic/server
DEFAULT_ACCESS_CONTROL_HEADERS
zimic/server
zimic/interceptor/server
DEFAULT_PREFLIGHT_STATUS_CODE
zimic/server
zimic/interceptor/server
3. Migrate from
runCommand
andCommandError
runCommand
andCommandError
were removed, mainly because:runCommand
did not make sense for Zimic's goal.runCommand
andCommandError
are not tied in any way to interceptor servers, so those utilities did not belong tozimic/interceptor/server
.runCommand
, especiallyexeca
andcross-spawn
.If you used
runCommand
before v0.8,execa
is a great alternative. For example:Can be refactored to:
See
execa
's documentation for more information.After that, you should be able to use Zimic v0.8 without any issues! If you face problems, feel free to open an issue or create a discussion.