0

I have a code that needs to be tested with Mocha. In a certain part of the code, this is included:

var deferred = $.Deferred();

And I am getting this error:

TypeError: $.Deferred is not a function

I tried to add jQuery to the Mocha tests, and that solved the issue of not knowing what $ was, but still getting an error when calling Deferred.

This is how I included jQuery for the tests:

global.$ = global.jQuery = require('jquery');
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
JorgeDLuffy
  • 190
  • 1
  • 9

0 Answers0