Replies: 1 comment
-
Hey @koerbcm Some kind of late but may be still useful for others in the feature I suffered the same behavior and I think there was a bug with this specific I tried intercepting an specific path and expecting not matched path calls should throw when net connection is disabled, however it made the real call is such case which the main idea was break any test if real calls are tried and intercept each call needed by tests I just sent a PR for fixing it that and it corresponding test showing this same behavior stated |
Beta Was this translation helpful? Give feedback.
-
I am trying to find a way to block all live traffic (
disableNetConnect
) with a few exceptions. When recording, we do not want to store fixtures(recordings) that are assets such as javascript, CSS, images, videos, etc. I would like these requests to be able to hit the live service since they shouldn't affect our tests and take up massive amounts of storage.In an attempt to do such a thing, I have looked into
disableNetConnect
, however, it only supports hosts, but in a microservice architecture, assets could come from any host or path. I attempted to use theallowUnmocked
option using the .intercept() function that states it can accept an options object. In theory, I would be able to specify the host and path to limit the unmocked response. From what I can gather,allowUnmocked
does not work here and in fact, the option seems to operate the same way asdisableNetConnect
, only applying to an entire host.e.g.
When trying this approach, even though we get a No Match, the request still fails and never tries to hit a live service. I have tried adding a
.reply
as well as options to force whatever we receive to not match in an attempt to force the request to hit the live service with no success.Wondering if there is any other way to support something like this? The only other option that comes to mind is to add something to our forwarding proxy that would go around Nock altogether, but that has a lot of issues itself.
Beta Was this translation helpful? Give feedback.
All reactions