Skip to content

Instantly share code, notes, and snippets.

@andrei-cacio
Last active June 12, 2016 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrei-cacio/a1c23d3cf15e8c4ddeeb1f80065169dd to your computer and use it in GitHub Desktop.
Save andrei-cacio/a1c23d3cf15e8c4ddeeb1f80065169dd to your computer and use it in GitHub Desktop.
jQuery getter function
let nodeJquery = null;
export function getJquery(spy = false) {
if (!nodeJquery) {
const sinon = require('sinon');
const fakeDOM = require('jsdom').jsdom();
nodeJquery = require('jquery')(fakeDOM.defaultView);
}
return nodeJquery;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment