はじめに TypeScript で Jest のモック機能を使おうとしたら、ハマりました。。。 解決方法を見つけたのでメモします。 対象読者 TypeScript の知識をある程度持っている Jest を TypeScript で実行できる環境がある 環境 node.js, 8.10.x typescript, 3.2.x axios, 0.18.x jest, 23.6.x ts-jest, 23.10.x macOS X El Capitan テスト対象 ソース import axios from 'axios'; export async function main() { try { const { data } = await axios.get('{YOUR-API-ENDPOINT}'); return data; // { message: "Real response!"