debian-mirror-gitlab/spec/frontend/mocks/node/jquery.js
2019-12-04 20:38:33 +05:30

15 lines
342 B
JavaScript

/* 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 = $;