You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
In order to write an effective unit test, you want to be able to isolate a unit of code and test only that unit – nothing else. It is fairly common and good practice to consider a module such a unit, and this is where Jest excels. Jest makes isolating a module from its dependencies extremely easy by automatically generating mocks for each of the module's dependencies and providing those mocks (rat
前回はTestUtilsの使い方を中心に説明したので、今回はfacebookが開発しているJestというフレームワークとの組み合わせてみたいと思います。 Painless JavaScript Unit Testing Jestのページには「Painless JavaScript Unit Testing」とある通り導入が簡単という特徴を持っています。 その特徴として「Mock By Default」があって、DefaultでCommonJS Styleのrequireを全てMockに置き換えます。ちょっと過激な感じですね。 なので、テスト対象の挙動だけに依存したテスト簡単に書くことが出来ます。逆に完全にテスト対象以外はMockになるのでI/FのテストにはならないですがまぁそれはUnit Testの範囲外ということで。 Jasmine JestはJasmineをベースとしてその上に作られて
似たようなモジュール名で存在している2つのアサーションライブラリ expect と expect.js を試してみる。 expect は「7,568 downloads in the last month」で、 expect.js は「100,149 downloads in the last month」 なので、 expect.js のほうが人気が高い。 expect は、 Node.js に標準搭載されている assert モジュールの薄いラッパーになっているとのこと。 expect is a thin wrapper around node's assert module that lets you write better assertions. mjackson/expect · GitHub expect.js は should.js をベースにしたBDDスタイルのアサーショ
JavaScript Advent Calendar 2011 (Node.js/WebSocketsコース)3日目のhokacchaです。Node.jsのテストフレームワーク、mochaについて書きます。 mochaはTJが新しく作り始めているテストフレームワークです。ドキュメントを見ればできることは大体書いてありますので、ドキュメントを元にどういうことができるのかを解説していきます。現時点でのバージョンは0.2.0です。 http://visionmedia.github.com/mocha/ shouldについて まずmochaでどういうことができるかの前にshouldについて解説しておきます。mochaのドキュメントには特に説明もなくshouldが使われていて、shouldでどういうことができるかわかってないと、ドキュメントを読んだときにmochaの機能なのかshouldの機能なの
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く