You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TESTING.md 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. ## Running the mustache.js Test Suite
  2. Notice: the tests are only expected to run on unixoid systems.
  3. The mustache.js test suite uses the [RSpec](http://rspec.info/) testing
  4. framework. In order to run the tests you'll need to install [Ruby](http://ruby-lang.org/)
  5. as well as the `rake`, `rspec` (>=2), and `json` [RubyGems](http://rubygems.org/).
  6. ### How to install Ruby and the required gems from source
  7. Make sure you have the required tools to compile it:
  8. $ apt-get install build-essential libssl-dev libreadline5-dev zlib1g-dev
  9. Download and extract the Ruby source, and install it:
  10. $ wget ftp://ftp.ruby-lang.org/pub/ruby/stable-snapshot.tar.gz
  11. $ tar xvzf stable-snapshot.tar.gz
  12. $ cd ruby
  13. $ ./configure && make && make install
  14. Download and extract RubyGems, and install it:
  15. $ wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.12.tgz
  16. $ tar xzvf rubygems-1.8.12.tgz
  17. $ cd rubygems-1.8.12
  18. $ ruby setup.rb
  19. If you want to update RubyGems:
  20. $ gem update --system
  21. Install the required gems:
  22. $ gem install rake rspec json
  23. That's it!
  24. ### How to install node.js from source
  25. $ git clone https://github.com/joyent/node.git
  26. $ cd node
  27. $ # select the version to install, master is unstable;
  28. $ # latest stable version is advertised on http://nodejs.org
  29. $ git checkout v0.6.11
  30. $ ./configure
  31. $ make
  32. $ sudo make install
  33. ### How to run the tests
  34. The mustache.js test suite currently uses 4 different JavaScript runtime engines
  35. to maximize portability across platforms and browsers. They are:
  36. * node
  37. * SpiderMonkey (Mozilla, Firefox)
  38. * JavaScriptCore (WebKit, Safari)
  39. * Rhino (Mozilla, Java)
  40. When the test suite runs it will automatically determine which platforms are
  41. available on your machine and run on all of them. The suite must run on at least
  42. one platform in order to succeed.
  43. Once you have at least one JavaScript platform installed, you can run the test
  44. suite with the following command:
  45. $ rake
  46. ### How to create a test
  47. All test files live in the spec/_files directory. To create a new test:
  48. * Create a template file `somename.mustache`
  49. * Create a javascript file with data and functions `somename.js`
  50. * Create a file the expected result `somename.txt`