summaryrefslogtreecommitdiff
path: root/spec/frontend/mocks/node/jquery.js
blob: 5c82f65406e8f2f58f4688e371f686d31f50f89e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* eslint-disable import/no-commonjs */

const $ = jest.requireActual('jquery');

// Fail tests for unmocked requests
$.ajax = () => {
  const err = new Error(
    'Unexpected unmocked jQuery.ajax() call! Make sure to mock jQuery.ajax() in tests.',
  );
  global.fail(err);
  throw err;
};

// jquery is not an ES6 module
module.exports = $;