Skip to content

pincheira/travis_jasmine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a skeleton Travis CI setup, for testing pure javascript projects (not node.js) with jasmine

Setup Locally

NOTE: This is not mandatory. Travis won't care if your local setup works.

git clone git@github.com:pwmckenna/travis_jasmine.git
cd travis_jasmine
bundle install
bundle exec rake

If this works, then you're probably safe to just do cp -R * YOUR_REPO_PATH and assume that once you've enabled travis on your repo, things will work.

Update files to reference your code

Start by copying this entire project into the root of your project. You'll want to make sure to update the following files with your javascript file paths.
Note: Don't add your spec files here, just the javascript required by those tests...

  • spec/javascripts/support/jasmine.yml
src_files:
   - spec/javascripts/lib/jquery.js
   - spec/javascripts/lib/json2.js
   - spec/javascripts/lib/underscore.js
   - spec/javascripts/lib/backbone.js
   # ADD OTHER FILES HERE!

For instance, my Backbrace project's jasmine.yml references the backbrace.min.js file as well

src_files:
   - spec/javascripts/lib/jquery.js
   - spec/javascripts/lib/json2.js
   - spec/javascripts/lib/underscore.js
   - spec/javascripts/lib/backbone.js
   - backbrace.js
  • spec/SpecRunner.html You don't need to update this file to get everything working on Travis, but it'll allow you to run your unit tests in a browser, which can be occasionally useful. You just need to include your javascript files like you would with any other html file.
  <!-- include source files here... -->
  <script src="javascripts/lib/jquery.js"></script>
	<script src="javascripts/javascripts/lib/json2.js"></script>
	<script src="javascripts/lib/underscore.js"></script>
  <script src="javascripts/lib/backbone.js"></script>
  <!-- add your files here! -->

Great, you're ready to roll. Time to write tests!

This part is easy. Open up spec/javascripts/specs/sample_spec.js and flesh out those Jasmine tests. Feel free to add additional spec files in this directory. They will be run automatically for you.

(function() {
    describe('Tests', function() {
      it('tests stuff with jasmine', function() {
        expect(true).toBeTruthy();
      });
    });
}).call(this);

Setup Travis

You can either log into travis and set up your repo via the toggle, or follow the how-to to do it manually.

Once you've done that, you can add the travis-ci build status icon to your readme. The link looks like the following:
https://secure.travis-ci.org/username/repository.png

When you're done, hopefully you'll have one of these to show off.
travis

Good Luck!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published