始めに この記事は以下の記事の続きです。 Jestを使わないでReactをUnitTestする 目的・ゴールはこちらの記事でご確認ください。 試してみる https://github.com/uryyyyyyy/React_mocha_boilerplate をダウンロードして、 をしたあとに、 gulp test:testUtil --path src/reactComponents/_tests_/nestComponentTest.js あたりを試してみてください。 (Node.js v0.10.Xで動かすときは、jsdomの設定によってはエラーになります。適宜jsdomをいじってください。) 仕組みの概要 mochaベースにする。 テスト対象がrequireしているものをproxyrequireでmockする。 テストの前にjsx->jsの変換を済ませてしまう。(babelを使う。
It totally feels like cheating, but since no one else is answering the question, here goes: Proxyquire takes over require and lets you inject fakes anywhere in the dependency chain. For requires you don't take over and for methods you don't define for requires you do take over, it'll fall back to the original. This can be disabled with noCallThru. Thus it still loads the original, just replaces th
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く