##What is Preceptor? Today, there are a lot of testing frameworks out there, many of which are optimized for testing specific areas. A couple of these frameworks are: Mocha - The most popular unit-testing tool (according to NPM downloads), testing each individual unit/component of a system in isolation. Cucumber - A high-level acceptance testing tool that tests features through scenarios, giving p
var mockRegister = MyDispatcher.register; var mockRegisterInfo = mockRegister.mock; var callsToRegister = mockRegisterInfo.calls; var firstCall = callsToRegister[0]; var firstArgument = firstCall[0]; var callback = firstArgument; Jestは基本全てがモックされるので、要は「Dispatcherのregisterに与えられた引数が観測できるから、Storeのcallbackを捕捉してテストしたい内容に合わせて適宜実行せよ」ということである。 この動作、SinonのSpyにも同じような実装がある。spy.firstCallやspy.getCallが定義されており、n度
Having tests is important. They allow us to extend and refactor our code with ease. Many developers follow test driven development as a workflow. I believe that writing tests makes software development much more interesting and generally leads to better code. Well-designed and tested systems are easier to maintain. Over the last few years, developers have begun to put a lot of application logic in
Wallaby.js runs your JavaScript and TypeScript tests as you type, streaming results next to your code. It also feeds rich runtime context to AI tools to help you write and fix code faster. Instant Actionable Feedback Time Travel Debugger Practical Test Insights Test run results and coverage update in real time, right next to your code. Tools like time travel debugging and value explorer help you f
ユニットテストがしにくい状態となってるコードをTestiumを使ったE2Eテストを書いてリファクタリングしてみる話です。 例えば、以下のようなjQueryで書いたコードは外(テストコード)から取り出すポイントがないので、ユニットテストを書くのは難しいと思います。(そもそもViewのコードなので) 特定のバージョンでの変更点を簡単に確認できるよう、 「Aの列のラジオボタンを選ぶと同じ行より一つ下にあるBの列のラジオボタンを自動で選ぶ」 という補助機能 $(document).ready(function () { // seq: シーケンス番号 $.each(["new_version", "old_version"], function () { $("input[name='" + this + "']").each(function (idx, elem) { if (idx == 0
The Protractor community is getting bigger by the day. We have blogged about ways to get hands-on with Protractor and how to test your AngularJS apps with it. In this blog, let’s look beyond Protractor’s support for writing UI Tests for AngularJS. Let’s examine a few of Protractor’s shortcomings and then understand how they can be overcome with Page Objects. Protractor has Shortcomings?! Let us go
function coin(x) { return Math.random() < x; } こういう関数があったとして、どうテストを書くのか。 ぱっと思いつくのはこういう感じで、Math.random 自体を上書きするやり方。 describe("coin(x)", function() { it("works", sinon.test(function() { this.stub(Math, "random", function() { return 0.5; }); assert(coin(0.4) === false); assert(coin(0.5) === false); assert(coin(0.6) === true); })); }); このやり方、たしかに間違っていないんだけど、関数のインターフェース自体を変更した方が良いと思う。 function coin(x,
この記事はECMAScript 2015の事始めとして、ライブラリをECMAScript 2015で書いて公開するというところから始めるのがいいのではという内容です。 ECMAScript 2015(ES2015)はES6とも呼ばれていてどちらも同じものを指しますが、この記事ではES2015に統一します。 ECMAScriptのバージョンについては次のページを参照してください。 ECMAScript · JavaScriptの入門書 #jsprimer 2018-12-27: 追記 textlint/textlint-rule-helperのmasterはTypeScriptの実装へ変換されています。 Babelの実装はhttps://github.com/textlint/textlint-rule-helper/tree/2.0.1から参照できます Babel から TypeScrip
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く