Closed craigcosmo closed 1 month ago
Mockjax does not currently support the new ES6 import
/export
module system, so this would be a new feature. Definitely something we would like to do, but for now you should be able to use the global $.mockjax()
function in your tests. Check the README file in the project for how to create mocks.
Maybe the question was more about how to get it to work at all, not importing any methods directly. I got it working using Vitest:
import $ from "jquery";
import mockjaxFactory from "jquery-mockjax";
window.jQuery = window.$ = $;
mockjaxFactory(window.$, window);
I have code like this
method.js
home.spect.js
Do you have suggestion how to use mockajax in this case? I want to mock the jquery request and return
good
if the request is success.