Service mocked with Jest causes “The module factory of jest.mock() is not allowed to reference any out-of-scope variables” error

前端 未结 5 1688
南方客
南方客 2020-12-08 18:53

I\'m trying to mock a call to a service but I\'m struggeling with the following message: The module factory of jest.mock() is not allowed to reference a

5条回答
  •  执笔经年
    2020-12-08 19:20

    If you are getting similar error when upgrading to newer Jest [19 to 21 in my case], you can try changing jest.mock to jest.doMock.

    Found this here – https://github.com/facebook/jest/commit/6a8c7fb874790ded06f4790fdb33d8416a7284c8

提交回复
热议问题