Mute jQuery Migrate in Ruby on Rails test environment

624 views Asked by At

Our rails project receives a lot of JQMIGRATE message when running tests, eg:

JQMIGRATE: jQuery.fn.attr(selected) may use property instead of attribute
JQMIGRATE: jQuery.browser is deprecated

Obviously it would be good to fix them, but they seem to be due to other gems anyway.

I've seen reference to jQuery.migrateMute = true, but not sure where to include it, and more importantly, would like to mute in test environment but not development. What's the best way?

1

There are 1 answers

0
Bigxiang On

Jquery-Migrate is a javascript library. So you can add jQuery.migrateMute = true in application.js before you start using deprecated method of jquery. Because it's just js, so I think you can comment in it while developing and comment out it while testing :)