Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] How to disable Mock not found.. warnings ? #10

Open
frezot opened this issue Sep 28, 2020 · 5 comments
Open

[question] How to disable Mock not found.. warnings ? #10

frezot opened this issue Sep 28, 2020 · 5 comments
Labels
question Further information is requested

Comments

@frezot
Copy link

frezot commented Sep 28, 2020

Or how to specify the endpoints which should not be mocked

@lukaszfiszer
Copy link
Member

Hi @frezot, sorry for taking so long to respond.

When Mockievelli is enabled, and unmatched fetch or XHR request is replied with 404 and an warning is logged in the console. This is by design to prevent the application under test to hit the real API by mistake in case you forgot to mock some of the endpoints.

Can you share your use case? Why you do not want to mock some of the enpoints?

@lukaszfiszer lukaszfiszer added the question Further information is requested label Oct 31, 2020
@thytran142
Copy link

In case I am using this to test Angular application, we have many request to http://localhost:4200/sockjs-node/info?t=....
I don't know how to mock those node js request (which is not necessary for my test case).

@frezot
Copy link
Author

frezot commented Nov 5, 2020

Hi, @lukaszfiszer.

Here is a couple examples:

  • Testing app use websockets for some parts, if I mock everything -- I will get unauthorized error from ws. So I decide not to mock authorization and it will works perfect for me
  • Testing app make tons of interaction, but I want to mock just one exact method (e.g. its unstable, or backend in progress)
  • Testing app use google-analytics (or some other external system) which is definite is not a subject of a test

@phil-isaacs
Copy link

phil-isaacs commented Apr 27, 2021

Is there any way to turn off this "Mock not found for request: type=xhr method=GET" error. It's making it very hard to write tests. I'm also working on an Angular project and currently the application won't render with all the 404's

@ktryniszewski-mdsol
Copy link

ktryniszewski-mdsol commented Apr 28, 2021

@lukaszfiszer maybe we can at least add an option to set what type of requests to intercept on setup
i.e)

options = { interceptedTypes = [ 'xhr'] }

We are working on react app and get a bunch of mock not found for things like

Mock not found for request: type=fetch method=GET url=http://localhost:3000/my_app/static/js/vendors~main.chunk.js
Mock not found for request: type=fetch method=GET url=http://localhost:3000/my_app/static/js/main.chunk.js
Mock not found for request: type=fetch method=GET url=http://localhost:3000/my_app/static/js/bundle.js

if we could at least omit fetch and prevent those 404s, it would be helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants