LoginSignup
12
12

More than 5 years have passed since last update.

JavaScriptをテスト駆動開発する環境を整える

Last updated at Posted at 2013-03-28

いちいち同じ事を書くのも変なので、こちらに切り出しておきます。

JasmineのMatcher

Matchers · pivotal/jasmine Wiki

非推奨になったMatcherはどれか、などの記述がある。

Jasmine Setup

  1. コンソールで実行
$ mkdir flickr-client
$ cd flickr-client
$ jasmine init
$ rake jasmine
  1. ブラウザで確認
http://localhost:8888

Guard Setup

  1. コンソールで実行
$ guard init
$ mkdir public/coffeescripts
$ mkdir spec/coffeescripts
$ vi Guardfile
  1. コードを書く
Guardfile
guard 'coffeescript', input: 'public/coffeescripts', output: 'public/javascripts'
guard 'coffeescript', input: 'spec/coffeescripts', output: 'spec/javascripts'

guard 'livereload' do
  watch(%r{public/.+\.(css|js|html)})
  watch(%r{spec/.+\.(css|js|html)})
end
  1. コンソールで実行
$ guard
  1. ChromeのLiveReloadをEnableする

Other Setup

  1. 必要なライブラリをpublic/javascriptsフォルダにコピーする
$ cp .../jquery.js public/javascripts
$ cp .../knockout-2.1.0.js public/javascripts

ブログやってます:PAPA-tronix !

12
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
12