本記事ではTypeScriptとSWC、Jestの組み合わせ環境でjest.spyOnを使う方法をexportパターン別に書いていきます。また、jest.spyOn対象の実装の詳細はテストせず、モック化したインターフェースのテストのみを行う前提で書いています。 確認環境 サンプルコード default export編 child.ts parent.ts parent.spec.ts named export編 child.ts parent.ts parent.spec.ts namespace export編 child.ts parent.ts parent.spec.ts module export編 child.ts parent.ts parent.spec.ts おまけ:それぞれのトランスパイル結果 default export編 child.js parent.js nam