evergreen 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.rdoc +8 -6
- data/lib/evergreen.rb +8 -6
- data/lib/evergreen/application.rb +2 -5
- data/lib/evergreen/helper.rb +33 -0
- data/lib/evergreen/runner.rb +1 -1
- data/lib/evergreen/server.rb +1 -0
- data/lib/evergreen/suite.rb +6 -0
- data/lib/evergreen/version.rb +1 -1
- data/lib/evergreen/views/run.erb +16 -6
- data/lib/jasmine/Contribute.markdown +8 -7
- data/lib/jasmine/Gemfile +0 -1
- data/lib/jasmine/README.markdown +1 -8
- data/lib/jasmine/Rakefile +26 -15
- data/lib/jasmine/Release.markdown +8 -6
- data/lib/jasmine/config.rb +29 -0
- data/lib/jasmine/jasmine-core.gemspec +9 -2
- data/lib/jasmine/jasmine_dev.thor +1 -0
- data/lib/jasmine/jshint/run.js +1 -1
- data/lib/jasmine/lib/jasmine-core/jasmine-html.js +427 -1
- data/lib/jasmine/lib/jasmine-core/jasmine.css +81 -166
- data/lib/jasmine/lib/jasmine-core/jasmine.js +245 -192
- data/lib/jasmine/lib/jasmine-core/version.rb +1 -1
- data/lib/jasmine/spec/core/MatchersSpec.js +273 -0
- data/lib/jasmine/spec/core/PrettyPrintSpec.js +7 -0
- data/lib/jasmine/spec/html/HTMLReporterSpec.js +209 -0
- data/lib/jasmine/spec/node_suite.js +2 -2
- data/lib/jasmine/spec/runner.html +10 -3
- data/lib/jasmine/spec/spec_helper.rb +51 -0
- data/lib/jasmine/spec/tasks/build_distribution_spec.rb +33 -0
- data/lib/jasmine/spec/tasks/build_github_pages_spec.rb +69 -0
- data/lib/jasmine/spec/tasks/build_standalone_distribution_spec.rb +109 -0
- data/lib/jasmine/spec/tasks/build_standalone_runner_spec.rb +63 -0
- data/lib/jasmine/spec/tasks/count_specs_spec.rb +26 -0
- data/lib/jasmine/spec/tasks/execute_specs_spec.rb +81 -0
- data/lib/jasmine/spec/tasks/jshint_spec.rb +39 -0
- data/lib/jasmine/spec/tasks/release_spec.rb +39 -0
- data/lib/jasmine/spec/tasks/version_spec.rb +55 -0
- data/lib/jasmine/spec/templates/runner.html.erb +3 -3
- data/lib/jasmine/src/core/Env.js +10 -2
- data/lib/jasmine/src/core/Matchers.js +33 -4
- data/lib/jasmine/src/core/PrettyPrinter.js +2 -2
- data/lib/jasmine/src/core/base.js +15 -0
- data/lib/jasmine/src/core/mock-timeout.js +0 -0
- data/lib/jasmine/src/html/HtmlReporter.js +101 -0
- data/lib/jasmine/src/html/HtmlReporterHelpers.js +60 -0
- data/lib/jasmine/src/html/ReporterView.js +164 -0
- data/lib/jasmine/src/html/SpecView.js +79 -0
- data/lib/jasmine/src/html/SuiteView.js +22 -0
- data/lib/jasmine/src/html/TrivialReporter.js +3 -1
- data/lib/jasmine/src/html/_HTMLReporter.scss +302 -0
- data/lib/jasmine/src/html/_TrivialReporter.scss +169 -0
- data/lib/jasmine/src/html/jasmine.css +81 -166
- data/lib/jasmine/src/html/jasmine.scss +2 -0
- data/lib/jasmine/src/templates/version.js.erb +1 -0
- data/lib/jasmine/src/version.js +3 -2
- data/lib/jasmine/src/version.json +1 -1
- data/lib/jasmine/tasks/jasmine_dev.rb +18 -0
- data/lib/jasmine/tasks/jasmine_dev/base.rb +54 -0
- data/lib/jasmine/tasks/jasmine_dev/build_distribution.rb +53 -0
- data/lib/jasmine/tasks/jasmine_dev/build_github_pages.rb +31 -0
- data/lib/jasmine/tasks/jasmine_dev/build_standalone_distribution.rb +49 -0
- data/lib/jasmine/tasks/jasmine_dev/build_standalone_runner.rb +59 -0
- data/lib/jasmine/tasks/jasmine_dev/count_specs.rb +29 -0
- data/lib/jasmine/tasks/jasmine_dev/execute_specs.rb +52 -0
- data/lib/jasmine/tasks/jasmine_dev/js_hint.rb +13 -0
- data/lib/jasmine/tasks/jasmine_dev/release.rb +16 -0
- data/lib/jasmine/tasks/jasmine_dev/sources.rb +32 -0
- data/lib/jasmine/tasks/jasmine_dev/version.rb +62 -0
- data/spec/helper_spec.rb +25 -0
- data/spec/suite1/spec/javascripts/{spec_helper.coffee → helpers/spec_helper.coffee} +0 -0
- data/spec/suite1/spec/javascripts/{spec_helper.js → helpers/spec_helper.js} +0 -0
- data/spec/suite1/spec/javascripts/templates_spec.js +6 -6
- data/spec/suite2/spec/awesome_spec.js +1 -1
- data/spec/suite_spec.rb +6 -0
- metadata +116 -52
- data/lib/jasmine/src/SourcesList.json +0 -7
- data/lib/jasmine/tasks/build_dist.rb +0 -48
- data/lib/jasmine/tasks/build_specs.rb +0 -50
- data/lib/jasmine/tasks/helpers.rb +0 -50
- data/lib/jasmine/tasks/pages.rb +0 -13
- data/lib/jasmine/tasks/spec.rb +0 -37
- data/lib/jasmine/tasks/standalone.rb +0 -91
- data/lib/jasmine/tasks/version.rb +0 -5
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YzIxZWE5Njc1ZmZkMzI2OTVmN2MwMmY5MDEwMGQ3OTQ5NDVhNzFjOA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZWQwY2RjNmI3MjAxYzMwODVhZTMxNDZjYjczNDk2ZDc0NWQ5OTY0OQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZmNjNGQ2OWU0NjdjNGFjYjVkMTlhMDkzMzkyNjdjNGU1OTQ2NDJlN2Q5NTdh
|
10
|
+
NWU2N2Q2NzQwZTFiYjI3MmViZGE0MDhhNmU2MjRkODdmY2U1MTk4MDVhNzE4
|
11
|
+
YTZjNjgwMjk2MmU5YjM4ZTg3MWI3ZjUxZjAzZGE0MjZkYTk4ZGI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZDI0OWYzYzA0MGI1YzNmNGJiYTA5ODIzMmFmNDI3NzI5MjQ3MmRiM2MxMDc1
|
14
|
+
OThhOWE0YWI0MGEwM2FmZDNhYzFlMWY5OWI1OTE3NmY1ODQyZWI0MzdiNDdi
|
15
|
+
YzRhYjVkNTE2NjBlZWQ2ZTYzZjI2OGIyMjhlNTU0NDg4MjhkNDA=
|
data/README.rdoc
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
= Evergreen
|
2
2
|
|
3
|
+
{<img src="http://travis-ci.org/jnicklas/evergreen.png" />}[http://travis-ci.org/jnicklas/evergreen]
|
4
|
+
|
3
5
|
"Because green is the new Blue(Ridge)"
|
4
6
|
|
5
7
|
Evergreen is a tool to run javascript unit tests for client side JavaScript. It
|
@@ -16,13 +18,10 @@ isolation from your application. If you need a tool that tests how your
|
|
16
18
|
JavaScript integrates with your application you should use an integration
|
17
19
|
testing framework, such as {Capybara}[http://github.com/jnicklas/capybara].
|
18
20
|
|
19
|
-
==
|
21
|
+
== Maintenance note
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
reproducible error, please {file it on
|
24
|
-
GitHub}[https://github.com/jnicklas/evergreen/issues]. Do not contact the
|
25
|
-
maintainers directly.
|
23
|
+
Jonas has kindly given me push access so I can help maintain the project and manage pull requests.
|
24
|
+
If you have any questions or suggestions please feel free to {contact me}[http://github.com/abepetrillo]
|
26
25
|
|
27
26
|
== Installation
|
28
27
|
|
@@ -154,6 +153,9 @@ Evergreen supports specs written in
|
|
154
153
|
{CoffeeScript}[http://github.com/jashkenas/coffee-script]. Just name your spec
|
155
154
|
file _spec.coffee and it will automatically be translated for you.
|
156
155
|
|
156
|
+
Note that since CoffeeScript files are not compiled by Sprockets (as in Rails),
|
157
|
+
the double-extension .js.coffee is not supported.
|
158
|
+
|
157
159
|
You can also add a CoffeeScript spec helper, but remember that CoffeeScript
|
158
160
|
encloses individual files in a closure, if you need something you define in the
|
159
161
|
spec helper to be available in your spec files, attach it to the window object:
|
data/lib/evergreen.rb
CHANGED
@@ -13,9 +13,10 @@ module Evergreen
|
|
13
13
|
autoload :Suite, 'evergreen/suite'
|
14
14
|
autoload :Spec, 'evergreen/spec'
|
15
15
|
autoload :Template, 'evergreen/template'
|
16
|
+
autoload :Helper, 'evergreen/helper'
|
16
17
|
|
17
18
|
class << self
|
18
|
-
attr_accessor :driver, :
|
19
|
+
attr_accessor :driver, :root, :application, :public_dir, :spec_dir, :template_dir, :helper_dir, :mounted_at
|
19
20
|
|
20
21
|
def configure
|
21
22
|
yield self
|
@@ -23,12 +24,13 @@ module Evergreen
|
|
23
24
|
|
24
25
|
def use_defaults!
|
25
26
|
configure do |config|
|
26
|
-
config.application
|
27
|
-
config.driver
|
28
|
-
config.public_dir
|
29
|
-
config.spec_dir
|
27
|
+
config.application = Evergreen::Application
|
28
|
+
config.driver = :selenium
|
29
|
+
config.public_dir = 'public'
|
30
|
+
config.spec_dir = 'spec/javascripts'
|
30
31
|
config.template_dir = 'spec/javascripts/templates'
|
31
|
-
config.
|
32
|
+
config.helper_dir = 'spec/javascripts/helpers'
|
33
|
+
config.mounted_at = ""
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
@@ -22,16 +22,12 @@ module Evergreen
|
|
22
22
|
|
23
23
|
get '/run/all' do
|
24
24
|
@suite = Evergreen::Suite.new
|
25
|
-
@js_spec_helper = @suite.get_spec('spec_helper.js')
|
26
|
-
@coffee_spec_helper = @suite.get_spec('spec_helper.coffee')
|
27
25
|
erb :run
|
28
26
|
end
|
29
27
|
|
30
28
|
get '/run/*' do |name|
|
31
29
|
@suite = Evergreen::Suite.new
|
32
|
-
@spec
|
33
|
-
@js_spec_helper = @suite.get_spec('spec_helper.js')
|
34
|
-
@coffee_spec_helper = @suite.get_spec('spec_helper.coffee')
|
30
|
+
@spec = @suite.get_spec(name)
|
35
31
|
erb :run
|
36
32
|
end
|
37
33
|
|
@@ -46,5 +42,6 @@ module Evergreen
|
|
46
42
|
get '/*' do |path|
|
47
43
|
send_file File.join(Evergreen.root, Evergreen.public_dir, path)
|
48
44
|
end
|
45
|
+
|
49
46
|
end
|
50
47
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Evergreen
|
2
|
+
class Helper
|
3
|
+
|
4
|
+
attr_reader :name, :suite
|
5
|
+
|
6
|
+
def initialize(suite, name)
|
7
|
+
@suite = suite
|
8
|
+
@name = name
|
9
|
+
end
|
10
|
+
|
11
|
+
def root
|
12
|
+
suite.root
|
13
|
+
end
|
14
|
+
|
15
|
+
def full_path
|
16
|
+
File.join(root, Evergreen.helper_dir, name)
|
17
|
+
end
|
18
|
+
|
19
|
+
def read
|
20
|
+
if full_path =~ /\.coffee$/
|
21
|
+
require 'coffee-script'
|
22
|
+
CoffeeScript.compile(File.read(full_path))
|
23
|
+
else
|
24
|
+
File.read(full_path)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
alias_method :contents, :read
|
28
|
+
|
29
|
+
def exist?
|
30
|
+
File.exist?(full_path)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/evergreen/runner.rb
CHANGED
data/lib/evergreen/server.rb
CHANGED
data/lib/evergreen/suite.rb
CHANGED
data/lib/evergreen/version.rb
CHANGED
data/lib/evergreen/views/run.erb
CHANGED
@@ -4,8 +4,10 @@
|
|
4
4
|
<script type="text/javascript" src="<%= url("/resources/run.js") %>"></script>
|
5
5
|
<script type="text/javascript">
|
6
6
|
// <![CDATA[
|
7
|
-
|
8
|
-
|
7
|
+
<% @suite.helpers.each do |helper| %>
|
8
|
+
<%= render_spec(helper) %>;
|
9
|
+
<% end %>
|
10
|
+
|
9
11
|
<% if @spec %>
|
10
12
|
<%= render_spec(@spec) %>
|
11
13
|
<% else %>
|
@@ -32,10 +34,18 @@
|
|
32
34
|
<% @suite.templates.each do |template| %>
|
33
35
|
Evergreen.templates[<%= template.name.to_json %>] = <%= template.escaped_contents %>;
|
34
36
|
<% end %>
|
35
|
-
var
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
var jasmineExecute = function() {
|
38
|
+
var jasmineEnv = jasmine.getEnv();
|
39
|
+
jasmineEnv.addReporter(new jasmine.TrivialReporter());
|
40
|
+
jasmineEnv.addReporter(new Evergreen.ReflectiveReporter());
|
41
|
+
jasmineEnv.execute();
|
42
|
+
};
|
43
|
+
if (window.addEventListener) {
|
44
|
+
window.addEventListener("load", jasmineExecute, false);
|
45
|
+
}
|
46
|
+
else {
|
47
|
+
window.attachEvent("onload", jasmineExecute);
|
48
|
+
}
|
39
49
|
})();
|
40
50
|
// ]]>
|
41
51
|
</script>
|
@@ -12,7 +12,7 @@ Or, How to make a successful pull request
|
|
12
12
|
* _Be environment agnostic_ - server-side developers are just as important as browser developers
|
13
13
|
* _Be browser agnostic_ - if you must rely on browser-specific functionality, please write it in a way that degrades gracefully
|
14
14
|
* _Write specs_ - Jasmine's a testing framework; don't add functionality without test-driving it
|
15
|
-
* _Ensure the *entire* test suite is green_ in all the big browsers, Node, and JSHint - your contribution shouldn't break Jasmine for other users
|
15
|
+
* _Ensure the *entire* test suite is green_ in all the big browsers, Node, and JSHint - your contribution shouldn't break Jasmine for other users
|
16
16
|
|
17
17
|
Follow these tips and your pull request, patch, or suggestion is much more likely to be integrated.
|
18
18
|
|
@@ -34,11 +34,12 @@ As in all good projects, the `spec/` directory mirrors `src/` and follows the sa
|
|
34
34
|
|
35
35
|
You will notice that all specs are run against the built `jasmine.js` instead of the component source files. This is intentional as a way to ensure that the concatenation code is working correctly.
|
36
36
|
|
37
|
-
Please ensure all specs are green before committing.
|
37
|
+
Please ensure all specs are green before committing or issuing a pull request.
|
38
38
|
|
39
|
-
There are
|
40
|
-
|
41
|
-
* `
|
42
|
-
* `
|
43
|
-
* `
|
39
|
+
There are Thor tasks to help with getting green - run `thor list` to see them all. Here are the key tasks:
|
40
|
+
|
41
|
+
* `thor jasmine_dev:execute_specs` outputs the expected number of specs that should be run and attempts to run in browser and Node
|
42
|
+
* `thor jasmine_dev:execute_specs_in_browser` opens `spec/runner.html` in the default browser on MacOS. Please run this in at least Firefox and Chrome before committing
|
43
|
+
* `thor jasmine_dev:execute_specs_in_node` runs all the Jasmine specs in Node.js - it will complain if Node is not installed
|
44
|
+
* `thor jasmine_dev:js_hint` runs all the files through JSHint and will complain about potential viable issues with your code. Fix them.
|
44
45
|
|
data/lib/jasmine/Gemfile
CHANGED
data/lib/jasmine/README.markdown
CHANGED
@@ -6,18 +6,11 @@ Jasmine is a Behavior Driven Development testing framework for JavaScript. It do
|
|
6
6
|
|
7
7
|
Documentation & guides live here: [http://pivotal.github.com/jasmine/](http://pivotal.github.com/jasmine/)
|
8
8
|
|
9
|
-
## What's Here?
|
10
|
-
|
11
|
-
*
|
12
|
-
|
13
|
-
|
14
|
-
|
15
9
|
|
16
10
|
## Support
|
17
11
|
|
18
12
|
* Search past discussions: [http://groups.google.com/group/jasmine-js](http://groups.google.com/group/jasmine-js)
|
19
13
|
* Send an email to the list: [jasmine-js@googlegroups.com](jasmine-js@googlegroups.com)
|
20
|
-
* Check the current build status: [ci.pivotallabs.com](http://ci.pivotallabs.com)
|
21
14
|
* View the project backlog at Pivotal Tracker: [http://www.pivotaltracker.com/projects/10606](http://www.pivotaltracker.com/projects/10606)
|
22
15
|
* Follow us on Twitter: [@JasmineBDD](http://twitter.com/JasmineBDD)
|
23
16
|
|
@@ -28,4 +21,4 @@ Documentation & guides live here: [http://pivotal.github.com/jasmine/](http://pi
|
|
28
21
|
* [Rajan Agaskar](mailto:rajan@pivotallabs.com), Pivotal Labs
|
29
22
|
* [Christian Williams](mailto:antixian666@gmail.com), Square
|
30
23
|
|
31
|
-
Copyright (c) 2008-
|
24
|
+
Copyright (c) 2008-2012 Pivotal Labs. This software is licensed under the MIT License.
|
data/lib/jasmine/Rakefile
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require "bundler"
|
2
2
|
Bundler::GemHelper.install_tasks
|
3
|
-
require "term/ansicolor"
|
4
3
|
require "json"
|
5
4
|
require "tilt"
|
6
5
|
|
@@ -8,26 +7,38 @@ Dir["#{File.dirname(__FILE__)}/tasks/**/*.rb"].each do |file|
|
|
8
7
|
require file
|
9
8
|
end
|
10
9
|
|
11
|
-
|
10
|
+
desc "Run all Jasmine JS specs"
|
11
|
+
task :jasmine_specs do
|
12
|
+
jasmine_dev = JasmineDev.new
|
12
13
|
|
13
|
-
|
14
|
-
raise "Submodule for Github Pages isn't present. Run git submodule update --init" unless pages_submodule_present
|
15
|
-
end
|
14
|
+
return unless jasmine_dev.node_installed?
|
16
15
|
|
17
|
-
|
18
|
-
raise "\nNode.js is required to develop code for Jasmine. Please visit http://nodejs.org to install.\n\n" unless node_installed?
|
19
|
-
end
|
16
|
+
system "thor jasmine_dev:execute_specs"
|
20
17
|
|
21
|
-
|
22
|
-
File.exist?('pages/download.html')
|
18
|
+
puts "\n\033[33m>>> DEPRECATED <<< Run Jasmine's JavaScript specs with 'thor jasmine_dev:execute_specs'\n\033[0m"
|
23
19
|
end
|
24
20
|
|
25
|
-
|
26
|
-
|
21
|
+
desc "Run all Jasmine core tests (JavaScript and dev tasks)"
|
22
|
+
task :spec => :require_pages_submodule do
|
23
|
+
jasmine_dev = JasmineDev.new
|
24
|
+
|
25
|
+
return unless jasmine_dev.node_installed?
|
26
|
+
|
27
|
+
system "rspec"
|
27
28
|
end
|
28
29
|
|
29
|
-
|
30
|
-
|
30
|
+
task :require_pages_submodule do
|
31
|
+
jasmine_dev = JasmineDev.new
|
32
|
+
|
33
|
+
unless jasmine_dev.pages_submodule_installed?
|
34
|
+
puts 'Installing the Github pages submodule:'
|
35
|
+
system 'git submodule update --init'
|
36
|
+
puts 'Now continuing...'
|
37
|
+
end
|
31
38
|
end
|
32
39
|
|
33
|
-
|
40
|
+
desc "View full development tasks"
|
41
|
+
task :list_dev_tasks do
|
42
|
+
puts "Jasmine uses Thor for command line tasks for development. Here is the command set:"
|
43
|
+
system "thor list"
|
44
|
+
end
|
@@ -5,8 +5,11 @@ ___Jasmine Core Maintainers Only___
|
|
5
5
|
|
6
6
|
Follow the instructions in `Contribute.markdown` during development.
|
7
7
|
|
8
|
-
### Git
|
8
|
+
### Git Rules
|
9
9
|
|
10
|
+
Please work on feature branches.
|
11
|
+
|
12
|
+
Please attempt to keep commits to `master` small, but cohesive. If a feature is contained in a bunch of small commits (e.g., it has several wip commits), please squash them when merging back to `master`.
|
10
13
|
|
11
14
|
### Version
|
12
15
|
|
@@ -16,10 +19,11 @@ The current version lives in the file `src/version.json`. This file should be se
|
|
16
19
|
|
17
20
|
This version is used by both `jasmine.js` and the `jasmine-core` Ruby gem.
|
18
21
|
|
22
|
+
Note that Jasmine should *not* use the "patch" version number. Let downstream projects rev their patch versions as needed, keeping their major and minor version numbers in sync with Jasmine core.
|
19
23
|
|
20
24
|
### Update the Github Pages (as needed)
|
21
25
|
|
22
|
-
Github pages have to exist in a branch called gh-pages in order for their app to serve them. This repo adds that branch as a submodule under the `pages` directory. This is a bit of a hack, but it allows us to work with the pages and the source at the same time and with one set of rake tasks.
|
26
|
+
Github pages have to exist in a branch called `gh-pages` in order for their app to serve them. This repo adds that branch as a submodule under the `pages` directory. This is a bit of a hack, but it allows us to work with the pages and the source at the same time and with one set of rake tasks.
|
23
27
|
|
24
28
|
If you want to submit changes to this repo and aren't a Pivotal Labs employee, you can fork and work in the `gh-pages` branch. You won't be able to edit the pages in the submodule off of master.
|
25
29
|
|
@@ -29,12 +33,10 @@ The pages are built with [Frank](https://github.com/blahed/frank). All the sourc
|
|
29
33
|
|
30
34
|
When ready to release - specs are all green and the stories are done:
|
31
35
|
|
32
|
-
1. Update the version in `version.json` to a release candidate - add
|
36
|
+
1. Update the version in `version.json` to a release candidate - add a `release_candidate` property with a value of 1
|
33
37
|
1. Update any comments on the public interfaces
|
34
|
-
1. `rake doc` - builds the `jsdoc` pages
|
35
38
|
1. Update any links or top-level landing page for the Github Pages
|
36
|
-
1. `
|
37
|
-
1. `rake build_pages` - builds the Github Pages
|
39
|
+
1. `thor jasmine_dev:release_prep` - updates the version, builds the `.js` files, builds the standalone release, and builds the Github pages
|
38
40
|
1. `rake release` - tags the repo with the version, builds the `jasmine-core` gem, pushes the gem to Rubygems.org
|
39
41
|
|
40
42
|
There should be a post to Pivotal Labs blog and a tweet to that link.
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#
|
2
|
+
# Compass configuration file - for building Jasmine's 'final CSS files
|
3
|
+
#
|
4
|
+
|
5
|
+
# Require any additional compass plugins here.
|
6
|
+
|
7
|
+
# Set this to the root of your project when deployed:
|
8
|
+
http_path = "/"
|
9
|
+
css_dir = "src/html"
|
10
|
+
sass_dir = "src/html"
|
11
|
+
images_dir = "images"
|
12
|
+
javascripts_dir = "javascripts"
|
13
|
+
|
14
|
+
# You can select your preferred output style here (can be overridden via the command line):
|
15
|
+
# output_style = :expanded or :nested or :compact or :compressed
|
16
|
+
output_style = :compact
|
17
|
+
|
18
|
+
# To enable relative paths to assets via compass helper functions. Uncomment:
|
19
|
+
# relative_assets = true
|
20
|
+
|
21
|
+
# To disable debugging comments that display the original location of your selectors. Uncomment:
|
22
|
+
line_comments = false
|
23
|
+
|
24
|
+
|
25
|
+
# If you prefer the indented syntax, you might want to regenerate this
|
26
|
+
# project again passing --syntax sass, or you can uncomment this:
|
27
|
+
# preferred_syntax = :sass
|
28
|
+
# and then run:
|
29
|
+
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
|
@@ -6,17 +6,24 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = "jasmine-core"
|
7
7
|
s.version = Jasmine::Core::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = ["Rajan Agaskar", "Davis Frank", "Christian Williams"]
|
9
|
+
s.authors = ["Rajan Agaskar", "Davis W. Frank", "Christian Williams"]
|
10
10
|
s.summary = %q{JavaScript BDD framework}
|
11
11
|
s.description = %q{Test your JavaScript without any framework dependencies, in any environment, and with a nice descriptive syntax.}
|
12
12
|
s.email = %q{jasmine-js@googlegroups.com}
|
13
13
|
s.homepage = "http://pivotal.github.com/jasmine"
|
14
14
|
s.rubyforge_project = "jasmine-core"
|
15
|
+
s.license = "MIT"
|
15
16
|
|
16
17
|
s.files = Dir.glob("./lib/**/*") + Dir.glob("./lib/jasmine-core/spec/**/*.js")
|
17
18
|
s.require_paths = ["lib"]
|
18
|
-
s.add_development_dependency "term-ansicolor"
|
19
19
|
s.add_development_dependency "json_pure", ">= 1.4.3"
|
20
20
|
s.add_development_dependency "frank"
|
21
|
+
s.add_development_dependency "sass"
|
22
|
+
s.add_development_dependency "compass"
|
21
23
|
s.add_development_dependency "ragaskar-jsdoc_helper"
|
24
|
+
s.add_development_dependency "rspec"
|
25
|
+
s.add_development_dependency "fuubar"
|
26
|
+
s.add_development_dependency "awesome_print"
|
27
|
+
s.add_development_dependency "thor"
|
28
|
+
s.add_development_dependency "nokogiri"
|
22
29
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "#{File.expand_path(File.dirname(__FILE__))}/tasks/jasmine_dev"
|
data/lib/jasmine/jshint/run.js
CHANGED
@@ -1,3 +1,429 @@
|
|
1
|
+
jasmine.HtmlReporterHelpers = {};
|
2
|
+
|
3
|
+
jasmine.HtmlReporterHelpers.createDom = function(type, attrs, childrenVarArgs) {
|
4
|
+
var el = document.createElement(type);
|
5
|
+
|
6
|
+
for (var i = 2; i < arguments.length; i++) {
|
7
|
+
var child = arguments[i];
|
8
|
+
|
9
|
+
if (typeof child === 'string') {
|
10
|
+
el.appendChild(document.createTextNode(child));
|
11
|
+
} else {
|
12
|
+
if (child) {
|
13
|
+
el.appendChild(child);
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
for (var attr in attrs) {
|
19
|
+
if (attr == "className") {
|
20
|
+
el[attr] = attrs[attr];
|
21
|
+
} else {
|
22
|
+
el.setAttribute(attr, attrs[attr]);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
return el;
|
27
|
+
};
|
28
|
+
|
29
|
+
jasmine.HtmlReporterHelpers.getSpecStatus = function(child) {
|
30
|
+
var results = child.results();
|
31
|
+
var status = results.passed() ? 'passed' : 'failed';
|
32
|
+
if (results.skipped) {
|
33
|
+
status = 'skipped';
|
34
|
+
}
|
35
|
+
|
36
|
+
return status;
|
37
|
+
};
|
38
|
+
|
39
|
+
jasmine.HtmlReporterHelpers.appendToSummary = function(child, childElement) {
|
40
|
+
var parentDiv = this.dom.summary;
|
41
|
+
var parentSuite = (typeof child.parentSuite == 'undefined') ? 'suite' : 'parentSuite';
|
42
|
+
var parent = child[parentSuite];
|
43
|
+
|
44
|
+
if (parent) {
|
45
|
+
if (typeof this.views.suites[parent.id] == 'undefined') {
|
46
|
+
this.views.suites[parent.id] = new jasmine.HtmlReporter.SuiteView(parent, this.dom, this.views);
|
47
|
+
}
|
48
|
+
parentDiv = this.views.suites[parent.id].element;
|
49
|
+
}
|
50
|
+
|
51
|
+
parentDiv.appendChild(childElement);
|
52
|
+
};
|
53
|
+
|
54
|
+
|
55
|
+
jasmine.HtmlReporterHelpers.addHelpers = function(ctor) {
|
56
|
+
for(var fn in jasmine.HtmlReporterHelpers) {
|
57
|
+
ctor.prototype[fn] = jasmine.HtmlReporterHelpers[fn];
|
58
|
+
}
|
59
|
+
};
|
60
|
+
|
61
|
+
jasmine.HtmlReporter = function(_doc) {
|
62
|
+
var self = this;
|
63
|
+
var doc = _doc || window.document;
|
64
|
+
|
65
|
+
var reporterView;
|
66
|
+
|
67
|
+
var dom = {};
|
68
|
+
|
69
|
+
// Jasmine Reporter Public Interface
|
70
|
+
self.logRunningSpecs = false;
|
71
|
+
|
72
|
+
self.reportRunnerStarting = function(runner) {
|
73
|
+
var specs = runner.specs() || [];
|
74
|
+
|
75
|
+
if (specs.length == 0) {
|
76
|
+
return;
|
77
|
+
}
|
78
|
+
|
79
|
+
createReporterDom(runner.env.versionString());
|
80
|
+
doc.body.appendChild(dom.reporter);
|
81
|
+
|
82
|
+
reporterView = new jasmine.HtmlReporter.ReporterView(dom);
|
83
|
+
reporterView.addSpecs(specs, self.specFilter);
|
84
|
+
};
|
85
|
+
|
86
|
+
self.reportRunnerResults = function(runner) {
|
87
|
+
reporterView && reporterView.complete();
|
88
|
+
};
|
89
|
+
|
90
|
+
self.reportSuiteResults = function(suite) {
|
91
|
+
reporterView.suiteComplete(suite);
|
92
|
+
};
|
93
|
+
|
94
|
+
self.reportSpecStarting = function(spec) {
|
95
|
+
if (self.logRunningSpecs) {
|
96
|
+
self.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
|
97
|
+
}
|
98
|
+
};
|
99
|
+
|
100
|
+
self.reportSpecResults = function(spec) {
|
101
|
+
reporterView.specComplete(spec);
|
102
|
+
};
|
103
|
+
|
104
|
+
self.log = function() {
|
105
|
+
var console = jasmine.getGlobal().console;
|
106
|
+
if (console && console.log) {
|
107
|
+
if (console.log.apply) {
|
108
|
+
console.log.apply(console, arguments);
|
109
|
+
} else {
|
110
|
+
console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
|
111
|
+
}
|
112
|
+
}
|
113
|
+
};
|
114
|
+
|
115
|
+
self.specFilter = function(spec) {
|
116
|
+
if (!focusedSpecName()) {
|
117
|
+
return true;
|
118
|
+
}
|
119
|
+
|
120
|
+
return spec.getFullName().indexOf(focusedSpecName()) === 0;
|
121
|
+
};
|
122
|
+
|
123
|
+
return self;
|
124
|
+
|
125
|
+
function focusedSpecName() {
|
126
|
+
var specName;
|
127
|
+
|
128
|
+
(function memoizeFocusedSpec() {
|
129
|
+
if (specName) {
|
130
|
+
return;
|
131
|
+
}
|
132
|
+
|
133
|
+
var paramMap = [];
|
134
|
+
var params = doc.location.search.substring(1).split('&');
|
135
|
+
|
136
|
+
for (var i = 0; i < params.length; i++) {
|
137
|
+
var p = params[i].split('=');
|
138
|
+
paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
|
139
|
+
}
|
140
|
+
|
141
|
+
specName = paramMap.spec;
|
142
|
+
})();
|
143
|
+
|
144
|
+
return specName;
|
145
|
+
}
|
146
|
+
|
147
|
+
function createReporterDom(version) {
|
148
|
+
dom.reporter = self.createDom('div', { id: 'HTMLReporter', className: 'jasmine_reporter' },
|
149
|
+
dom.banner = self.createDom('div', { className: 'banner' },
|
150
|
+
self.createDom('span', { className: 'title' }, "Jasmine "),
|
151
|
+
self.createDom('span', { className: 'version' }, version)),
|
152
|
+
|
153
|
+
dom.symbolSummary = self.createDom('ul', {className: 'symbolSummary'}),
|
154
|
+
dom.alert = self.createDom('div', {className: 'alert'}),
|
155
|
+
dom.results = self.createDom('div', {className: 'results'},
|
156
|
+
dom.summary = self.createDom('div', { className: 'summary' }),
|
157
|
+
dom.details = self.createDom('div', { id: 'details' }))
|
158
|
+
);
|
159
|
+
}
|
160
|
+
};
|
161
|
+
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter);jasmine.HtmlReporter.ReporterView = function(dom) {
|
162
|
+
this.startedAt = new Date();
|
163
|
+
this.runningSpecCount = 0;
|
164
|
+
this.completeSpecCount = 0;
|
165
|
+
this.passedCount = 0;
|
166
|
+
this.failedCount = 0;
|
167
|
+
this.skippedCount = 0;
|
168
|
+
|
169
|
+
this.createResultsMenu = function() {
|
170
|
+
this.resultsMenu = this.createDom('span', {className: 'resultsMenu bar'},
|
171
|
+
this.summaryMenuItem = this.createDom('a', {className: 'summaryMenuItem', href: "#"}, '0 specs'),
|
172
|
+
' | ',
|
173
|
+
this.detailsMenuItem = this.createDom('a', {className: 'detailsMenuItem', href: "#"}, '0 failing'));
|
174
|
+
|
175
|
+
this.summaryMenuItem.onclick = function() {
|
176
|
+
dom.reporter.className = dom.reporter.className.replace(/ showDetails/g, '');
|
177
|
+
};
|
178
|
+
|
179
|
+
this.detailsMenuItem.onclick = function() {
|
180
|
+
showDetails();
|
181
|
+
};
|
182
|
+
};
|
183
|
+
|
184
|
+
this.addSpecs = function(specs, specFilter) {
|
185
|
+
this.totalSpecCount = specs.length;
|
186
|
+
|
187
|
+
this.views = {
|
188
|
+
specs: {},
|
189
|
+
suites: {}
|
190
|
+
};
|
191
|
+
|
192
|
+
for (var i = 0; i < specs.length; i++) {
|
193
|
+
var spec = specs[i];
|
194
|
+
this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom, this.views);
|
195
|
+
if (specFilter(spec)) {
|
196
|
+
this.runningSpecCount++;
|
197
|
+
}
|
198
|
+
}
|
199
|
+
};
|
200
|
+
|
201
|
+
this.specComplete = function(spec) {
|
202
|
+
this.completeSpecCount++;
|
203
|
+
|
204
|
+
if (isUndefined(this.views.specs[spec.id])) {
|
205
|
+
this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom);
|
206
|
+
}
|
207
|
+
|
208
|
+
var specView = this.views.specs[spec.id];
|
209
|
+
|
210
|
+
switch (specView.status()) {
|
211
|
+
case 'passed':
|
212
|
+
this.passedCount++;
|
213
|
+
break;
|
214
|
+
|
215
|
+
case 'failed':
|
216
|
+
this.failedCount++;
|
217
|
+
break;
|
218
|
+
|
219
|
+
case 'skipped':
|
220
|
+
this.skippedCount++;
|
221
|
+
break;
|
222
|
+
}
|
223
|
+
|
224
|
+
specView.refresh();
|
225
|
+
this.refresh();
|
226
|
+
};
|
227
|
+
|
228
|
+
this.suiteComplete = function(suite) {
|
229
|
+
var suiteView = this.views.suites[suite.id];
|
230
|
+
if (isUndefined(suiteView)) {
|
231
|
+
return;
|
232
|
+
}
|
233
|
+
suiteView.refresh();
|
234
|
+
};
|
235
|
+
|
236
|
+
this.refresh = function() {
|
237
|
+
|
238
|
+
if (isUndefined(this.resultsMenu)) {
|
239
|
+
this.createResultsMenu();
|
240
|
+
}
|
241
|
+
|
242
|
+
// currently running UI
|
243
|
+
if (isUndefined(this.runningAlert)) {
|
244
|
+
this.runningAlert = this.createDom('a', {href: "?", className: "runningAlert bar"});
|
245
|
+
dom.alert.appendChild(this.runningAlert);
|
246
|
+
}
|
247
|
+
this.runningAlert.innerHTML = "Running " + this.completeSpecCount + " of " + specPluralizedFor(this.totalSpecCount);
|
248
|
+
|
249
|
+
// skipped specs UI
|
250
|
+
if (isUndefined(this.skippedAlert)) {
|
251
|
+
this.skippedAlert = this.createDom('a', {href: "?", className: "skippedAlert bar"});
|
252
|
+
}
|
253
|
+
|
254
|
+
this.skippedAlert.innerHTML = "Skipping " + this.skippedCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";
|
255
|
+
|
256
|
+
if (this.skippedCount === 1 && isDefined(dom.alert)) {
|
257
|
+
dom.alert.appendChild(this.skippedAlert);
|
258
|
+
}
|
259
|
+
|
260
|
+
// passing specs UI
|
261
|
+
if (isUndefined(this.passedAlert)) {
|
262
|
+
this.passedAlert = this.createDom('span', {href: "?", className: "passingAlert bar"});
|
263
|
+
}
|
264
|
+
this.passedAlert.innerHTML = "Passing " + specPluralizedFor(this.passedCount);
|
265
|
+
|
266
|
+
// failing specs UI
|
267
|
+
if (isUndefined(this.failedAlert)) {
|
268
|
+
this.failedAlert = this.createDom('span', {href: "?", className: "failingAlert bar"});
|
269
|
+
}
|
270
|
+
this.failedAlert.innerHTML = "Failing " + specPluralizedFor(this.failedCount);
|
271
|
+
|
272
|
+
if (this.failedCount === 1 && isDefined(dom.alert)) {
|
273
|
+
dom.alert.appendChild(this.failedAlert);
|
274
|
+
dom.alert.appendChild(this.resultsMenu);
|
275
|
+
}
|
276
|
+
|
277
|
+
// summary info
|
278
|
+
this.summaryMenuItem.innerHTML = "" + specPluralizedFor(this.runningSpecCount);
|
279
|
+
this.detailsMenuItem.innerHTML = "" + this.failedCount + " failing";
|
280
|
+
};
|
281
|
+
|
282
|
+
this.complete = function() {
|
283
|
+
dom.alert.removeChild(this.runningAlert);
|
284
|
+
|
285
|
+
this.skippedAlert.innerHTML = "Ran " + this.runningSpecCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";
|
286
|
+
|
287
|
+
if (this.failedCount === 0) {
|
288
|
+
dom.alert.appendChild(this.createDom('span', {className: 'passingAlert bar'}, "Passing " + specPluralizedFor(this.passedCount)));
|
289
|
+
} else {
|
290
|
+
showDetails();
|
291
|
+
}
|
292
|
+
|
293
|
+
dom.banner.appendChild(this.createDom('span', {className: 'duration'}, "finished in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"));
|
294
|
+
};
|
295
|
+
|
296
|
+
return this;
|
297
|
+
|
298
|
+
function showDetails() {
|
299
|
+
if (dom.reporter.className.search(/showDetails/) === -1) {
|
300
|
+
dom.reporter.className += " showDetails";
|
301
|
+
}
|
302
|
+
}
|
303
|
+
|
304
|
+
function isUndefined(obj) {
|
305
|
+
return typeof obj === 'undefined';
|
306
|
+
}
|
307
|
+
|
308
|
+
function isDefined(obj) {
|
309
|
+
return !isUndefined(obj);
|
310
|
+
}
|
311
|
+
|
312
|
+
function specPluralizedFor(count) {
|
313
|
+
var str = count + " spec";
|
314
|
+
if (count > 1) {
|
315
|
+
str += "s"
|
316
|
+
}
|
317
|
+
return str;
|
318
|
+
}
|
319
|
+
|
320
|
+
};
|
321
|
+
|
322
|
+
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.ReporterView);
|
323
|
+
|
324
|
+
|
325
|
+
jasmine.HtmlReporter.SpecView = function(spec, dom, views) {
|
326
|
+
this.spec = spec;
|
327
|
+
this.dom = dom;
|
328
|
+
this.views = views;
|
329
|
+
|
330
|
+
this.symbol = this.createDom('li', { className: 'pending' });
|
331
|
+
this.dom.symbolSummary.appendChild(this.symbol);
|
332
|
+
|
333
|
+
this.summary = this.createDom('div', { className: 'specSummary' },
|
334
|
+
this.createDom('a', {
|
335
|
+
className: 'description',
|
336
|
+
href: '?spec=' + encodeURIComponent(this.spec.getFullName()),
|
337
|
+
title: this.spec.getFullName()
|
338
|
+
}, this.spec.description)
|
339
|
+
);
|
340
|
+
|
341
|
+
this.detail = this.createDom('div', { className: 'specDetail' },
|
342
|
+
this.createDom('a', {
|
343
|
+
className: 'description',
|
344
|
+
href: '?spec=' + encodeURIComponent(this.spec.getFullName()),
|
345
|
+
title: this.spec.getFullName()
|
346
|
+
}, this.spec.getFullName())
|
347
|
+
);
|
348
|
+
};
|
349
|
+
|
350
|
+
jasmine.HtmlReporter.SpecView.prototype.status = function() {
|
351
|
+
return this.getSpecStatus(this.spec);
|
352
|
+
};
|
353
|
+
|
354
|
+
jasmine.HtmlReporter.SpecView.prototype.refresh = function() {
|
355
|
+
this.symbol.className = this.status();
|
356
|
+
|
357
|
+
switch (this.status()) {
|
358
|
+
case 'skipped':
|
359
|
+
break;
|
360
|
+
|
361
|
+
case 'passed':
|
362
|
+
this.appendSummaryToSuiteDiv();
|
363
|
+
break;
|
364
|
+
|
365
|
+
case 'failed':
|
366
|
+
this.appendSummaryToSuiteDiv();
|
367
|
+
this.appendFailureDetail();
|
368
|
+
break;
|
369
|
+
}
|
370
|
+
};
|
371
|
+
|
372
|
+
jasmine.HtmlReporter.SpecView.prototype.appendSummaryToSuiteDiv = function() {
|
373
|
+
this.summary.className += ' ' + this.status();
|
374
|
+
this.appendToSummary(this.spec, this.summary);
|
375
|
+
};
|
376
|
+
|
377
|
+
jasmine.HtmlReporter.SpecView.prototype.appendFailureDetail = function() {
|
378
|
+
this.detail.className += ' ' + this.status();
|
379
|
+
|
380
|
+
var resultItems = this.spec.results().getItems();
|
381
|
+
var messagesDiv = this.createDom('div', { className: 'messages' });
|
382
|
+
|
383
|
+
for (var i = 0; i < resultItems.length; i++) {
|
384
|
+
var result = resultItems[i];
|
385
|
+
|
386
|
+
if (result.type == 'log') {
|
387
|
+
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
|
388
|
+
} else if (result.type == 'expect' && result.passed && !result.passed()) {
|
389
|
+
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
|
390
|
+
|
391
|
+
if (result.trace.stack) {
|
392
|
+
messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
|
393
|
+
}
|
394
|
+
}
|
395
|
+
}
|
396
|
+
|
397
|
+
if (messagesDiv.childNodes.length > 0) {
|
398
|
+
this.detail.appendChild(messagesDiv);
|
399
|
+
this.dom.details.appendChild(this.detail);
|
400
|
+
}
|
401
|
+
};
|
402
|
+
|
403
|
+
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SpecView);jasmine.HtmlReporter.SuiteView = function(suite, dom, views) {
|
404
|
+
this.suite = suite;
|
405
|
+
this.dom = dom;
|
406
|
+
this.views = views;
|
407
|
+
|
408
|
+
this.element = this.createDom('div', { className: 'suite' },
|
409
|
+
this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(this.suite.getFullName()) }, this.suite.description)
|
410
|
+
);
|
411
|
+
|
412
|
+
this.appendToSummary(this.suite, this.element);
|
413
|
+
};
|
414
|
+
|
415
|
+
jasmine.HtmlReporter.SuiteView.prototype.status = function() {
|
416
|
+
return this.getSpecStatus(this.suite);
|
417
|
+
};
|
418
|
+
|
419
|
+
jasmine.HtmlReporter.SuiteView.prototype.refresh = function() {
|
420
|
+
this.element.className += " " + this.status();
|
421
|
+
};
|
422
|
+
|
423
|
+
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SuiteView);
|
424
|
+
|
425
|
+
/* @deprecated Use jasmine.HtmlReporter instead
|
426
|
+
*/
|
1
427
|
jasmine.TrivialReporter = function(doc) {
|
2
428
|
this.document = doc || document;
|
3
429
|
this.suiteDivs = {};
|
@@ -31,7 +457,7 @@ jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarA
|
|
31
457
|
jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
|
32
458
|
var showPassed, showSkipped;
|
33
459
|
|
34
|
-
this.outerDiv = this.createDom('div', { className: 'jasmine_reporter' },
|
460
|
+
this.outerDiv = this.createDom('div', { id: 'TrivialReporter', className: 'jasmine_reporter' },
|
35
461
|
this.createDom('div', { className: 'banner' },
|
36
462
|
this.createDom('div', { className: 'logo' },
|
37
463
|
this.createDom('span', { className: 'title' }, "Jasmine"),
|