Upgrade to Pro — share decks privately, control downloads, hide ads and more …

jestのspyOnでmockする際に詰まった話

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.

 jestのspyOnでmockする際に詰まった話

Avatar for riku0202

riku0202

July 20, 2022
Tweet

More Decks by riku0202

Other Decks in Programming

Transcript

  1. トランスパイル import { useRef } from "react" import * as

    React from "react" useRef React.useRef import React from "react" React.useRef
  2. _react.useRef _react.useRef トランスパイル import { useRef } from "react" import

    * as React from "react" useRef React.useRef import React from "react" React.useRef _react["default"].useRef
  3. [ 参考リンク ] Mock/Spy exported functions within a single module

    in Jest jest.spyOnで差し替わってなかった Jest spyOn() calls the actual function instead of the mocked