{"id":13463259,"url":"https://github.com/abepetrillo/evergreen","last_synced_at":"2025-03-25T06:31:43.391Z","repository":{"id":964635,"uuid":"755706","full_name":"abepetrillo/evergreen","owner":"abepetrillo","description":"Run Jasmine JavaScript unit tests, integrate them into Ruby applications.","archived":false,"fork":false,"pushed_at":"2023-05-05T09:51:27.000Z","size":221,"stargazers_count":447,"open_issues_count":5,"forks_count":61,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-29T13:50:41.420Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abepetrillo.png","metadata":{"files":{"readme":"README.rdoc","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2010-07-03T23:40:34.000Z","updated_at":"2024-10-09T02:52:59.000Z","dependencies_parsed_at":"2023-07-05T18:48:23.082Z","dependency_job_id":null,"html_url":"https://github.com/abepetrillo/evergreen","commit_stats":{"total_commits":199,"total_committers":27,"mean_commits":7.37037037037037,"dds":"0.48743718592964824","last_synced_commit":"4f3ea36eed95002f7ee038a0ed20538e47d0c264"},"previous_names":["jnicklas/evergreen"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abepetrillo%2Fevergreen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abepetrillo%2Fevergreen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abepetrillo%2Fevergreen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abepetrillo%2Fevergreen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abepetrillo","download_url":"https://codeload.github.com/abepetrillo/evergreen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245414005,"owners_count":20611357,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T13:00:49.175Z","updated_at":"2025-03-25T06:31:41.398Z","avatar_url":"https://github.com/abepetrillo.png","language":"Ruby","readme":"= Evergreen\n\n\nrdoc-image:https://coveralls.io/repos/github/abepetrillo/evergreen/badge.svg?branch=master\n\nrdoc-image:https://api.codeclimate.com/v1/badges/1bc70455454cbc60dd67/maintainability\n\n\n\"Because green is the new Blue(Ridge)\"gi\n\nEvergreen is a tool to run javascript unit tests for client side JavaScript. It\ncombines a server which allows you to serve up and run your specs in a browser,\nas well as a runner which uses Capybara and any of its drivers to run your\nspecs. Evergreen uses the Jasmine unit testing framework for JavaScript.\n\nhttp://github.com/abepetrillo/evergreen\n\n== Philosophy\n\nEvergreen is a unit testing tool. Its purpose is to test JavaScript in\nisolation from your application. If you need a tool that tests how your\nJavaScript integrates with your application you should use an integration\ntesting framework, such as {Capybara}[http://github.com/jnicklas/capybara].\n\n== Maintenance note\n\nJonas has kindly given me push access so I can help maintain the project and manage pull requests.\nIf you have any questions or suggestions please feel free to {contact me}[http://github.com/abepetrillo]\n\n== Installation\n\nInstall as a Ruby gem:\n\n    gem install evergreen\n\n== Usage\n\nEvergreen assumes a file and directory structure, place all your javascript\ncode inside ./public and all spec files inside ./spec/javascripts. All spec\nfiles should end in _spec.js. For example:\n\n    public/javascripts/widget.js\n    spec/javascripts/widget_spec.js\n\nYou can require files from the public directory inside your spec file:\n\n    require('/javascripts/widget.js')\n\n    describe('a widget', function() {\n      ...\n    });\n\nYou can now look at your spec files inside a browser by starting up the\nEvergreen server:\n\n    evergreen serve\n\nAlternatively you can run the specs headlessly by running:\n\n    evergreen run\n\n== Integrating with Rails 3\n\nAdd Evergreen to your Gemfile:\n\n    gem 'evergreen', :require =\u003e 'evergreen/rails'\n\nStart your rails application and navigate to /evergreen. You should now see a\nlist of all spec files, click on one to run it.\n\nThere's a rake task provided for you that you can use to run your specs:\n\n    rake spec:javascripts\n\n== Integrating with Rails 2\n\nAdd the following line to your Rakefile:\n\n    require 'evergreen/tasks'\n\nThis will give you the `spec:javascripts` rake task. Note that mounting is not\npossible under Rails 2 and that `require 'evergreen/rails'` will fail.\n\n== Configuration\n\nBy default, Evergreen uses Selenium to run your specs and assumes a certain\ndirectory structure. If this standard is fine for you, then you don't need to\ndo anything else. If you need to configure Evergreen to suit your needs,\nEvergreen will automatically look for and load the following files:\n\n    config/evergreen.rb\n    .evergreen\n    ~/.evergreen\n\nThe content of these files could look like this:\n\n    require 'capybara-webkit'\n\n    Evergreen.configure do |config|\n      config.driver = :webkit\n      config.public_dir = 'public_html'\n      config.template_dir = 'templates'\n      config.spec_dir = 'spec'\n    end\n\n== Transactions\n\nOne problem often faced when writing unit tests for client side code is that\nchanges to the page are not reverted for the next example, so that successive\nexamples become dependent on each other. Evergreen adds a special div to your\npage with an id of test. This div is automatically emptied before each example.\nYou should avoid appending markup to the page body and instead append it to\nthis test div:\n\n    describe('transactions', function() {\n      it(\"should add stuff in one test...\", function() {\n        $('#test').append('\u003ch1 id=\"added\"\u003eNew Stuff\u003c/h1\u003e');\n        expect($('#test h1#added').length).toEqual(1);\n      });\n\n      it(\"... should have been removed before the next starts\", function() {\n        expect($('#test h1#added').length).toEqual(0);\n      });\n    });\n\n== Templates\n\nEven more powerful than that, Evergreen allows you to create HTML templates to\ngo along with your specs. Put the templates in their own folder like this:\n\n    spec/javascripts/templates/one_template.html\n    spec/javascripts/templates/another_template.html\n\nYou can then load the template into the test div, by calling the template\nfunction in your specs:\n\n    describe('transactions', function() {\n      template('one_template.html')\n\n      it(\"should load the template in this test\", function() {\n        ...\n      });\n    });\n\n== Spec Helper\n\nIf you add a spec_helper file like so:\n\n    spec/javascripts/helpers/spec_helper.js\n\nIt will automatically be loaded. This is a great place for adding custom\nmatchers and the like.\n\n== CoffeeScript\n\nEvergreen supports specs written in\n{CoffeeScript}[http://github.com/jashkenas/coffee-script]. Just name your spec\nfile _spec.coffee and it will automatically be translated for you.\n\nNote that since CoffeeScript files are not compiled by Sprockets (as in Rails),\nthe double-extension .js.coffee is not supported.\n\nYou can also add a CoffeeScript spec helper, but remember that CoffeeScript\nencloses individual files in a closure, if you need something you define in the\nspec helper to be available in your spec files, attach it to the window object:\n\n    # spec/javascripts/helpers/spec_helper.coffee\n\n    MyThing: \"foo\"          # local to spec helper\n    window.MyThing: \"foo\"   # global\n\n== Development\n\nIf you plan to work on Evergreen, you need to checkout the Jasmine gem, which\nis added as a git submodule. Run the following command:\n\n    git submodule update --init\n\nIf you're using a version of Evergreen from git with bundler, you need to tell\nbundler to use submodules, this can be achieved with the following command:\n\n    gem 'evergreen', :submodules =\u003e true, :git =\u003e 'git://github.com/abepetrillo/evergreen.git'\n\n== License:\n\n(The MIT License)\n\nCopyright (c) 2009 Jonas Nicklas\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","funding_links":[],"categories":["JavaScript"],"sub_categories":["JavaScript Testing"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabepetrillo%2Fevergreen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabepetrillo%2Fevergreen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabepetrillo%2Fevergreen/lists"}