Cannot use it after update Jest
PengWang0316 opened this issue · comments
Kevin W. commented
When I was using Jest 23.1.0, the library runs perfectly. After I update Jest to 23.4.2 and jest-environment-jsdom to 23.4.0, the test give me message:
SecurityError: localStorage is not available for opaque origins
I added
"testURL": "http://localhost"
"verbose": true
to Jest configuration. But I still get the error message:
expect(jest.fn())[.not].toHaveBeenCalledTimes()
jest.fn() value must be a mock function or spy.
when I have test code like "expect(localStorage.removeItem).toHaveBeenCalledTimes(1);"
Geoff Dutton commented
#80 addresses this.
Kevin W. commented
Thank you for the answer. I actually find out the jsdom starts to support the localStorage. So, we can actually test the localStorage without mock.