Closed tomardern closed 4 years ago
pretender needs the other dependencies (fake-xml-http-request and route-recognizer) to work, for example those are included in tests https://github.com/pretenderjs/pretender/blob/v3.4.1/karma.conf.js#L17 This is indeed not ergonomic, I've put up https://github.com/pretenderjs/pretender/pull/302 which will allow you to install with
<script src=".../dist/pretender.bundle.js"></script>
@xg-wang Great stuff, looking forward to seeing this in the main repo :D
Hi,
I'm looking to use pretender to mock API requests for our E2E suite running Puppeteer. It's a cool project, and looking forward to sharing.
I'm trying to use Pretender in the browser, after injecting it into the page, I'm getting a
Cannot read property 'prototype' of undefined (XMLHTTPRequest)
error on this line:My guess here is that when installing pretender it doesn't bundle FakeXMLHttpRequest.
Are you able to add a bundle to your package which contains FakeXMLHttpRequest and any other dependancies, so that users of your library can just:
<script src=".../dist/pretender.js"></script>
What do I need to do here? It's not totally clear from the instructions how I can bundle this up and use it easily.
Thanks :)