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
mocha + power-assert環境の構築 ここでは、mocha + power-assert環境の設定手順とテストの実行方法をまとめています。尚、本ページの情報は、Web知識の浅い、Node.jsの扉を叩いている程度のレベルの私が、ググった情報です。従って、誤りや、ずれてるところも多々あると思います。引用したものについては、出来る限り引用元を記載しましたが漏れている可能性もあります。 mochaは、BDDスタイルでもTDDスタイルでも使えてグローバル変数のリーク検出までしてくれる(らしい)Node.js上で動作するテストフレームワークです。 power-assertは、前述フレームワークを用いたテストで用いるassertライブラリ(NG結果が他のライブラリより分かり易そうだなぁと思い選択しました)です。 この二つを組み合わせることにより、以下の様なイメージでserver側jsコー
前回 QiitaにReact.js の React.js の公式Tutorial を gulp を利用して簡単に実行できる環境を作って、ES6も試した で公式TutorialをECMA2015(ECMA6)を利用して書き直しを行ったのですが、ReactといえばFlux、Flux といえばRedux ということで、流行りのRedux を利用して記述したらどうなるのかを試してみました。 また 同じく流行りのテスト環境である Mocha + power-assert を利用して、テストを追加してみました。 React および Redux はテストも非常に行いやすいのを体感しました。 前回の続編として、以下GitHub で公開しています。 https://github.com/ma-tu/react-babel-gulp-browserify-tutorial/tree/es6-redux Rea
// Karma configuration // Generated on Mon Dec 21 2015 12:22:32 GMT+0900 (JST) module.exports = function(config) { config.set({ // base path that will be used to resolve all patterns (eg. files, exclude) basePath: '', // frameworks to use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter frameworks: ['mocha', 'browserify'], // list of files / patterns to load in the browser f
Node.js6連投. 第5弾! npm と Node.js 上で require を使ったモジュール読み込みの仕組みについてメモ Node.js 用に作った自作モジュール『merger』を npm で公開してみた Node.js 用の自作モジュールの作り方メモ Node.js 用に作った自作モジュールを npm に登録して公開する方法 JavaScript テストフレームワーク『Mocha』の使い方メモ <- いまここ JavaScript テストフレームワーク『Mocha』をブラウザ上で使う方法 Node.js もしくはブラウザ上で動く JavaScript テストフレームワーク『Mocha』の使い方について書きます. 最近, JavaScript による大規模開発も増えてきました. それに比例して重視されてくるのが, テスト環境の構築です. そこで, node.js のテストフレーム
(..or maybe Mocha 4. I don't know.) @mochajs/mocha + everyone, I mentioned this in the mochajs/maintainers room on Gitter, but since it appears people aren't using Gitter much, I'll repeat it here: Pitch Mocha's old. What's cool about that is that we know what's wrong with it. And indeed, it has problems which make certain issues difficult to address. The major issue is "plugins". Others include (
自動テストって意識高そうで恰好良いですよね! 普段ブラウザ用のJavaScriptしか書かない人なのですが、テストについて調べても、難しい話から始まる記事ばかりで「アサーションって何?」とか「何で通常のファイルとは別のjsが必要なの?」みたいな気持でした。この記事では簡単な前提条件から、mocha/chaiの使い方の概要が分かる部分までを説明したいと思います。 そもそもテストとは何? ソフトウェア開発におけるテストとは、ソフトウェアの振舞いが想定した通りであるかを検証することです。ソフトウェアのサブルーチンを取り出してテストする「単体テスト/ユニットテスト」と、ソフトウェア全体の挙動をテストする「結合テスト」があります。mocha・chaiはこのうちの「単体テスト」を対象としたツールです。 じゃあ単体テストって何をすることなの? 単体テストとは、ある特定の関数を対象に、入力値と出力値が仕様
describe('Todo', () => { var Todo: any = require('../lib/todo'); // 既に大部分が実装されているものとする var TodoStub: any; beforeEach(() => { /* TodoStub */ TodoStub = { get: sinon.stub(Todo.prototype, 'get').returns('dummy'), put: sinon.stub(Todo.prototype, 'put'), remove: sinon.stub(Todo.prototype, 'remove'), }; }); });
Chief Architect at Semaphore. A decade of experience in dev productivity, helping close to 50,000 organizations with operational excellence. Mocha is a testing library for Node.js, created to be a simple, extensible, and fast. It’s used for unit and integration testing, and it’s a great candidate for BDD (Behavior Driven Development). This article will walk you through its installation and configu
Test-driven development (TDD) , as many of you might know, is one of the main, agile development techniques. The genius of TDD lies in increased quality of code, faster development resulting from greater programmer confidence, and improved bug detection (duh!). Historically, web apps have been hard to autotest, and developers relied heavily on manual testing. But, certain parts such as standalone
フロントエンドエンジニア養成読本のテストランナーの項を写経してたら思いがけないエラーに遭遇したのでその解決方法。 まずは、本の通り、foo.jsとfoo_spec.jsを書いて設定ファイル(karma.conf.js)を作ってからターミナル上でKarmaを起動します。 すると、 PhantomJS 1.9.7 (Mac OS X) ERROR ReferenceError: Can't find variable: chai Chrome 36.0.1985 (Mac OS X 10.9.4) ERROR Uncaught ReferenceError: chai is not defined のエラーが。 そこで、 karma.conf.jsの中を見て、 frameworks: ['mocha'],の部分を frameworks: ['mocha', 'chai'],と書き換えて再度ター
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く