[Vuejs]-Error Cannot tween a null target in Unit test with GSAP-TweenMax, Jest and VueJs

1👍

Cannot tween a null target means that TweenMax methods are not mocked. Infact you are mocking just TweenMax.to method.

Please update your mock this way:

module.exports = {
  TweenMax: class {
    static to(selector, time, options) {
      return jest.fn()
    }
    static set(selector, options) {
      return jest.fn()
    }
  }
}

Let me know if that fixes it.

Leave a comment