jsdom-xhr-patch

1.1.0 • Public • Published

Build Status

Introduction

UPDATE: Please note that as of xmlhttprequest 1.8.0, withCredentials is finally supported so it should not be needed to include this patch anymore. However make sure that global.XMLHttpRequest is available before including jQuery.

Provides patch for XMLHttpRequest npm package which doesn't expose withCredentials property and causes incorrect behaviour when using jsdom with sinon.fakeServer.

Usage

Simply install the dependency:

npm install jsdom-xhr-patch --save

And apply the patch:

// Must be applied before jQuery and sinon are require'd
// but after window has been made available.
require('jsdom-xhr-patch').apply(window);

Please note that in case window.XMLHttpRequest doesn't need patching you'll be notified in the Node's console.

Tests

After cloning the repo you can run test suite by invoking:

git clone https://github.com/mareksuscak/jsdom-xhr-patch.git
cd jsdom-xhr-patch
npm install
npm test

License

See the LICENSE file.

Readme

Keywords

none

Package Sidebar

Install

npm i jsdom-xhr-patch

Weekly Downloads

8

Version

1.1.0

License

MIT

Last publish

Collaborators

  • mareksuscak