teaspoon 0.7.8 → 0.7.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -5
  3. data/app/assets/javascripts/teaspoon-angular.js +19 -27
  4. data/app/assets/javascripts/teaspoon-jasmine.js +19 -27
  5. data/app/assets/javascripts/teaspoon-mocha.js +19 -28
  6. data/app/assets/javascripts/teaspoon-qunit.js +41 -15
  7. data/app/assets/javascripts/teaspoon/base/reporters/html/failure_view.coffee +1 -1
  8. data/app/assets/javascripts/teaspoon/base/reporters/html/spec_view.coffee +1 -1
  9. data/app/assets/javascripts/teaspoon/base/reporters/html/suite_view.coffee +1 -1
  10. data/app/assets/javascripts/teaspoon/base/teaspoon.coffee +12 -7
  11. data/app/assets/javascripts/teaspoon/qunit/reporters/html.coffee +1 -1
  12. data/app/assets/stylesheets/teaspoon.css +1 -1
  13. data/app/helpers/teaspoon/spec_helper.rb +2 -1
  14. data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.coffee +4 -0
  15. data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.js +4 -0
  16. data/lib/generators/teaspoon/install/templates/mocha/spec_helper.coffee +6 -2
  17. data/lib/generators/teaspoon/install/templates/mocha/spec_helper.js +4 -0
  18. data/lib/generators/teaspoon/install/templates/qunit/test_helper.coffee +4 -0
  19. data/lib/generators/teaspoon/install/templates/qunit/test_helper.js +4 -0
  20. data/lib/teaspoon/configuration.rb +4 -3
  21. data/lib/teaspoon/coverage.rb +3 -2
  22. data/lib/teaspoon/drivers/phantomjs/runner.js +108 -0
  23. data/lib/teaspoon/drivers/phantomjs_driver.rb +25 -7
  24. data/lib/teaspoon/engine.rb +5 -0
  25. data/lib/teaspoon/environment.rb +2 -4
  26. data/lib/teaspoon/formatters/base_formatter.rb +9 -6
  27. data/lib/teaspoon/formatters/dot_formatter.rb +3 -2
  28. data/lib/teaspoon/formatters/pride_formatter.rb +48 -0
  29. data/lib/teaspoon/formatters/snowday_formatter.rb +20 -0
  30. data/lib/teaspoon/server.rb +9 -3
  31. data/lib/teaspoon/suite.rb +3 -3
  32. data/lib/teaspoon/version.rb +1 -1
  33. data/spec/dummy/config/initializers/teaspoon.rb +1 -1
  34. data/spec/javascripts/teaspoon/base/teaspoon_spec.coffee +4 -4
  35. data/spec/javascripts/teaspoon/other/erb_spec.js.coffee.erb +4 -0
  36. data/spec/javascripts/teaspoon/phantomjs/runner_spec.coffee +1 -1
  37. data/spec/teaspoon/configuration_spec.rb +2 -1
  38. data/spec/teaspoon/coverage_spec.rb +1 -1
  39. data/spec/teaspoon/drivers/phantomjs_driver_spec.rb +28 -14
  40. data/spec/teaspoon/environment_spec.rb +2 -3
  41. data/spec/teaspoon/formatters/base_formatter_spec.rb +3 -2
  42. data/spec/teaspoon/formatters/pride_formatter_spec.rb +0 -0
  43. data/spec/teaspoon/suite_spec.rb +5 -0
  44. data/vendor/assets/javascripts/support/bind-poly.js +23 -0
  45. metadata +10 -17
  46. data/lib/teaspoon/drivers/phantomjs/runner.coffee +0 -68
@@ -9,8 +9,9 @@ module Teaspoon
9
9
  YELLOW = 33
10
10
  CYAN = 36
11
11
 
12
- def spec(result)
13
- super
12
+ def spec(result, logged = false)
13
+ super(result)
14
+ return if logged
14
15
  if result.passing?
15
16
  log ".", GREEN
16
17
  elsif result.pending?
@@ -0,0 +1,48 @@
1
+ require 'teaspoon/formatters/dot_formatter'
2
+
3
+ module Teaspoon
4
+ module Formatters
5
+ class PrideFormatter < DotFormatter
6
+ PI_3 = Math::PI / 3
7
+
8
+ def initialize(*args)
9
+ @colors = (0...(6 * 7)).map { |n|
10
+ n *= 1.0 / 6
11
+ r = (3 * Math.sin(n ) + 3).to_i
12
+ g = (3 * Math.sin(n + 2 * PI_3) + 3).to_i
13
+ b = (3 * Math.sin(n + 4 * PI_3) + 3).to_i
14
+ 36 * r + 6 * g + b + 16
15
+ }
16
+ @size = @colors.size
17
+ @index = 0
18
+
19
+ super
20
+ end
21
+
22
+ def spec(result)
23
+ super(result, true)
24
+ if result.passing?
25
+ log_pride ".", next_color
26
+ elsif result.pending?
27
+ log "*", YELLOW
28
+ else
29
+ log "F", RED
30
+ end
31
+ end
32
+
33
+ private
34
+
35
+ def next_color
36
+ c = @colors[@index % @size]
37
+ @index += 1
38
+ c
39
+ end
40
+
41
+
42
+ def log_pride(str, color_code)
43
+ STDOUT.print("\e[38;5;#{color_code}m#{str}\e[0m")
44
+ end
45
+
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,20 @@
1
+ require 'teaspoon/formatters/dot_formatter'
2
+
3
+ module Teaspoon
4
+ module Formatters
5
+ class SnowdayFormatter < DotFormatter
6
+
7
+ def spec(result)
8
+ super(result, true)
9
+ if result.passing?
10
+ log "☃", GREEN
11
+ elsif result.pending?
12
+ log "☹", YELLOW
13
+ else
14
+ log "☠", RED
15
+ end
16
+ end
17
+
18
+ end
19
+ end
20
+ end
@@ -7,7 +7,13 @@ module Teaspoon
7
7
 
8
8
  def initialize
9
9
  @port = find_available_port
10
- Thin::Logging.silent = true if defined?(Thin)
10
+ if defined?(Thin)
11
+ if Teaspoon.configuration.suppress_log
12
+ Thin::Logging.silent = true
13
+ else
14
+ Thin::Logging.trace = false
15
+ end
16
+ end
11
17
  end
12
18
 
13
19
  def start
@@ -22,7 +28,7 @@ module Teaspoon
22
28
  end
23
29
 
24
30
  def wait_until_started
25
- Timeout.timeout(Teaspoon.configuration.server_timeout) { @thread.join(0.1) until responsive? }
31
+ Timeout.timeout(Teaspoon.configuration.server_timeout.to_i) { @thread.join(0.1) until responsive? }
26
32
  rescue Timeout::Error
27
33
  raise "Server failed to start. You may need to increase the timeout configuration."
28
34
  end
@@ -51,7 +57,7 @@ module Teaspoon
51
57
  Port: port,
52
58
  environment: "test",
53
59
  AccessLog: [],
54
- Logger: WEBrick::Log::new(nil, 0),
60
+ Logger: Rails.logger,
55
61
  server: Teaspoon.configuration.server
56
62
  }
57
63
  end
@@ -66,8 +66,8 @@ module Teaspoon
66
66
  end
67
67
 
68
68
  def link(params = {})
69
- query = "?#{params.to_query}" if params.present?
70
- [Teaspoon.configuration.mount_at, name, query].compact.join('/')
69
+ query = "/?#{params.to_query}" if params.present?
70
+ "#{Teaspoon.configuration.context}#{Teaspoon.configuration.mount_at}/#{name}#{query}"
71
71
  end
72
72
 
73
73
  def instrument_file?(file)
@@ -130,7 +130,7 @@ module Teaspoon
130
130
  filename = filename.gsub(%r(^#{Regexp.escape(path)}[\/|\\]), "")
131
131
  end
132
132
  raise Teaspoon::AssetNotServable, "#{filename} is not within an asset path" if filename == original
133
- filename.gsub(/(\.js\.coffee|\.coffee)$/, ".js")
133
+ filename.gsub('.erb', '').gsub(/(\.js\.coffee|\.coffee)$/, ".js")
134
134
  end
135
135
  end
136
136
  end
@@ -1,3 +1,3 @@
1
1
  module Teaspoon
2
- VERSION = "0.7.8"
2
+ VERSION = "0.7.9"
3
3
  end
@@ -4,7 +4,7 @@ Teaspoon.setup do |config|
4
4
  config.asset_paths << Teaspoon::Engine.root.join('lib/teaspoon')
5
5
 
6
6
  config.suite do |suite|
7
- suite.matcher = "{spec/javascripts,spec/dummy/app/assets/javascripts/specs}/**/*_spec.{js,js.coffee,coffee}"
7
+ suite.matcher = "{spec/javascripts,spec/dummy/app/assets/javascripts/specs}/**/*_spec.{js,js.coffee,coffee,js.coffee.erb}"
8
8
  suite.javascripts = ["teaspoon/jasmine"]
9
9
  end
10
10
 
@@ -21,14 +21,14 @@ describe "Teaspoon", ->
21
21
 
22
22
  beforeEach ->
23
23
  Teaspoon.defer = false
24
+ spyOn(Teaspoon, 'reload')
25
+ @spy = spyOn(Teaspoon, "Runner")
24
26
 
25
27
  it "allows defering (thus not instantiating the runner)", ->
26
28
  Teaspoon.defer = true
27
- spy = spyOn(Teaspoon, "Runner")
28
29
  Teaspoon.execute()
29
- expect(spy).wasNotCalled()
30
+ expect(@spy).wasNotCalled()
30
31
 
31
32
  it "will execute if it should", ->
32
- spy = spyOn(Teaspoon, "Runner")
33
33
  Teaspoon.execute()
34
- expect(spy).toHaveBeenCalled()
34
+ expect(@spy).toHaveBeenCalled()
@@ -0,0 +1,4 @@
1
+ describe "erb", ->
2
+
3
+ it "tests", ->
4
+ expect(true).toBe(true)
@@ -5,7 +5,7 @@
5
5
  window.phantom = {exit: ->}
6
6
  window.require = (file) ->
7
7
  switch file
8
- when "system" then {args: ["runner.coffee", "http://host:port/path", "200"]}
8
+ when "system" then {args: ["runner.js", "http://host:port/path", "200"]}
9
9
  when "webpage" then create: -> {
10
10
  open: -> {}
11
11
  evaluate: -> {}
@@ -51,6 +51,7 @@ describe Teaspoon::Configuration do
51
51
 
52
52
  it "has the default configuration" do
53
53
  expect(subject.mount_at).to eq("/teaspoon")
54
+ expect(subject.context).to eq(nil)
54
55
  expect(subject.asset_paths).to include("spec/javascripts")
55
56
  expect(subject.asset_paths).to include("spec/javascripts/stylesheets")
56
57
  expect(subject.fixture_path).to eq("spec/javascripts/fixtures")
@@ -87,7 +88,7 @@ describe Teaspoon::Configuration::Suite do
87
88
 
88
89
  it "has the default configuration" do
89
90
  subject = Teaspoon::Configuration::Suite.new
90
- expect(subject.matcher).to eq("{spec/javascripts,spec/dummy/app/assets/javascripts/specs}/**/*_spec.{js,js.coffee,coffee}")
91
+ expect(subject.matcher).to eq("{spec/javascripts,spec/dummy/app/assets/javascripts/specs}/**/*_spec.{js,js.coffee,coffee,js.coffee.erb}")
91
92
  expect(subject.helper).to eq("spec_helper")
92
93
  expect(subject.javascripts).to eq(["teaspoon/jasmine"])
93
94
  expect(subject.stylesheets).to eq(["teaspoon"])
@@ -3,7 +3,7 @@ require "teaspoon/coverage"
3
3
 
4
4
  describe Teaspoon::Coverage do
5
5
 
6
- subject { Teaspoon::Coverage.new({"foo" => "bar"}) }
6
+ subject { Teaspoon::Coverage.new({"foo" => "bar"}, "default") }
7
7
 
8
8
  describe "#reports" do
9
9
 
@@ -5,23 +5,37 @@ describe Teaspoon::Drivers::PhantomjsDriver do
5
5
 
6
6
  describe "#run_specs" do
7
7
 
8
- before do
9
- Phantomjs.stub(:run)
10
- end
8
+ context "with phantomjs" do
9
+
10
+ before do
11
+ subject.stub(:run)
12
+ end
13
+
14
+ it "instantiates the runner" do
15
+ runner = double(failure_count: nil)
16
+ Teaspoon::Runner.should_receive(:new).and_return(runner)
17
+ subject.run_specs(:default, "_url_")
18
+ end
19
+
20
+ it "calls run and logs the results of each line using the formatter" do
21
+ args = [Teaspoon::Engine.root.join("lib/teaspoon/drivers/phantomjs/runner.js").to_s, "_url_"]
22
+ Teaspoon::Runner.any_instance.should_receive(:process).with("_line_")
23
+ @block = nil
24
+ subject.should_receive(:run).with(*args) { |&b| @block = b }
25
+ subject.run_specs(:default, "_url_")
26
+ @block.call("_line_")
27
+ end
11
28
 
12
- it "instantiates the formatter" do
13
- runner = double(failure_count: nil)
14
- Teaspoon::Runner.should_receive(:new).and_return(runner)
15
- subject.run_specs(:default, "_url_")
16
29
  end
17
30
 
18
- it "calls phantomjs.run and logs the results of each line using the formatter" do
19
- args = [Teaspoon::Engine.root.join("lib/teaspoon/drivers/phantomjs/runner.coffee").to_s, "_url_"]
20
- Teaspoon::Runner.any_instance.should_receive(:process).with("_line_")
21
- @block = nil
22
- Phantomjs.should_receive(:run).with(*args) { |&b| @block = b }
23
- subject.run_specs(:default, "_url_")
24
- @block.call("_line_")
31
+ context "without phantomjs" do
32
+
33
+ it "tells you that it couldn't find phantomjs and exits" do
34
+ subject.should_receive(:which).and_return(nil)
35
+ STDOUT.should_receive(:print).with("Could not find PhantomJS. Install phantomjs or try the phantomjs gem.")
36
+ expect { subject.run_specs(:default, "_url_") }.to raise_error SystemExit
37
+ end
38
+
25
39
  end
26
40
 
27
41
  end
@@ -7,16 +7,15 @@ describe Teaspoon::Environment do
7
7
 
8
8
  describe ".load" do
9
9
 
10
- it "calls require_environment if Rails isn't available" do
11
- subject.should_receive(:rails_loaded?).and_return(false)
10
+ it "calls require_environment" do
12
11
  subject.should_receive(:require_environment)
13
12
  subject.should_receive(:rails_loaded?).and_return(true)
14
13
  Teaspoon::Environment.load
15
14
  end
16
15
 
17
16
  it "raises if Rails can't be found" do
18
- subject.should_receive(:rails_loaded?).twice.and_return(false)
19
17
  subject.should_receive(:require_environment)
18
+ subject.should_receive(:rails_loaded?).and_return(false)
20
19
  expect{ Teaspoon::Environment.load }.to raise_error("Rails environment not found.")
21
20
  end
22
21
 
@@ -22,7 +22,7 @@ describe Teaspoon::Formatters::BaseFormatter do
22
22
 
23
23
  it "logs the coverage information" do
24
24
  double = double(reports: nil)
25
- Teaspoon::Coverage.should_receive(:new).with("_data_").and_return(double)
25
+ Teaspoon::Coverage.should_receive(:new).with("_data_", "default").and_return(double)
26
26
  double.should_receive(:reports).and_return("_reports_")
27
27
  STDOUT.should_receive(:print).with("_reports_")
28
28
  subject.send(:log_coverage, "_data_")
@@ -35,7 +35,8 @@ describe Teaspoon::Formatters::BaseFormatter do
35
35
 
36
36
  it "doesn't log when suppressing logs" do
37
37
  subject.should_receive(:suppress_logs?).and_return(true)
38
- Teaspoon::Coverage.should_not_receive(:new)
38
+ Teaspoon::Coverage.should_receive(:new).and_return(double(reports: nil))
39
+ STDOUT.should_not_receive(:print)
39
40
  subject.send(:log_coverage, "_data_")
40
41
  end
41
42
 
File without changes
@@ -151,6 +151,11 @@ describe Teaspoon::Suite do
151
151
  expect(subject.link(file: ["file1", "file2"], grep: "foo")).to eql("/teaspoon/default/?file%5B%5D=file1&file%5B%5D=file2&grep=foo")
152
152
  end
153
153
 
154
+ it "returns a link prefixed by app context if given" do
155
+ Teaspoon.configuration.stub(:context).and_return('/foo')
156
+ expect(subject.link).to eql("/foo/teaspoon/default")
157
+ end
158
+
154
159
  end
155
160
 
156
161
  describe "#instrument_file?" do
@@ -0,0 +1,23 @@
1
+ if (!Function.prototype.bind) {
2
+ Function.prototype.bind = function (oThis) {
3
+ if (typeof this !== "function") {
4
+ // closest thing possible to the ECMAScript 5 internal IsCallable function
5
+ throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
6
+ }
7
+
8
+ var aArgs = Array.prototype.slice.call(arguments, 1),
9
+ fToBind = this,
10
+ fNOP = function () {},
11
+ fBound = function () {
12
+ return fToBind.apply(this instanceof fNOP && oThis
13
+ ? this
14
+ : oThis,
15
+ aArgs.concat(Array.prototype.slice.call(arguments)));
16
+ };
17
+
18
+ fNOP.prototype = this.prototype;
19
+ fBound.prototype = new fNOP();
20
+
21
+ return fBound;
22
+ };
23
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teaspoon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.8
4
+ version: 0.7.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - jejacks0n
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-12-23 00:00:00.000000000 Z
13
+ date: 2014-01-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties
@@ -32,20 +32,6 @@ dependencies:
32
32
  - - <
33
33
  - !ruby/object:Gem::Version
34
34
  version: '5'
35
- - !ruby/object:Gem::Dependency
36
- name: phantomjs
37
- requirement: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - '>='
40
- - !ruby/object:Gem::Version
41
- version: 1.8.1.1
42
- type: :runtime
43
- prerelease: false
44
- version_requirements: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - '>='
47
- - !ruby/object:Gem::Version
48
- version: 1.8.1.1
49
35
  description: Run Javascript tests using Jasmine, Mocha or QUnit in the browser or
50
36
  headlessly using PhantomJS or with Selenium Webdriver
51
37
  email:
@@ -110,7 +96,7 @@ files:
110
96
  - lib/teaspoon/console.rb
111
97
  - lib/teaspoon/coverage.rb
112
98
  - lib/teaspoon/drivers/base_driver.rb
113
- - lib/teaspoon/drivers/phantomjs/runner.coffee
99
+ - lib/teaspoon/drivers/phantomjs/runner.js
114
100
  - lib/teaspoon/drivers/phantomjs_driver.rb
115
101
  - lib/teaspoon/drivers/selenium_driver.rb
116
102
  - lib/teaspoon/engine.rb
@@ -121,6 +107,8 @@ files:
121
107
  - lib/teaspoon/formatters/clean_formatter.rb
122
108
  - lib/teaspoon/formatters/dot_formatter.rb
123
109
  - lib/teaspoon/formatters/junit_formatter.rb
110
+ - lib/teaspoon/formatters/pride_formatter.rb
111
+ - lib/teaspoon/formatters/snowday_formatter.rb
124
112
  - lib/teaspoon/formatters/swayze_or_oprah_formatter.rb
125
113
  - lib/teaspoon/formatters/tap_formatter.rb
126
114
  - lib/teaspoon/formatters/tap_y_formatter.rb
@@ -141,6 +129,7 @@ files:
141
129
  - vendor/assets/javascripts/mocha-1.10.1.MIT.LICENSE
142
130
  - vendor/assets/javascripts/qunit-1.12.0.js
143
131
  - vendor/assets/javascripts/qunit-1.12.0.MIT.LICENSE
132
+ - vendor/assets/javascripts/support/bind-poly.js
144
133
  - vendor/assets/javascripts/support/chai.js
145
134
  - vendor/assets/javascripts/support/chai.MIT.LICENSE
146
135
  - vendor/assets/javascripts/support/expect.js
@@ -209,6 +198,7 @@ files:
209
198
  - spec/javascripts/teaspoon/mocha/reporters/html_mspec.coffee
210
199
  - spec/javascripts/teaspoon/mocha/runner_mspec.coffee
211
200
  - spec/javascripts/teaspoon/mocha/spec_mspec.coffee
201
+ - spec/javascripts/teaspoon/other/erb_spec.js.coffee.erb
212
202
  - spec/javascripts/teaspoon/phantomjs/runner_spec.coffee
213
203
  - spec/javascripts/turbolinks_helper.coffee
214
204
  - spec/spec_helper.rb
@@ -225,6 +215,7 @@ files:
225
215
  - spec/teaspoon/formatters/base_formatter_spec.rb
226
216
  - spec/teaspoon/formatters/dot_formatter_spec.rb
227
217
  - spec/teaspoon/formatters/junit_formatter_spec.rb
218
+ - spec/teaspoon/formatters/pride_formatter_spec.rb
228
219
  - spec/teaspoon/formatters/tap_formatter_spec.rb
229
220
  - spec/teaspoon/formatters/tap_y_formatter_spec.rb
230
221
  - spec/teaspoon/formatters/teamcity_formatter_spec.rb
@@ -323,6 +314,7 @@ test_files:
323
314
  - spec/javascripts/teaspoon/mocha/reporters/html_mspec.coffee
324
315
  - spec/javascripts/teaspoon/mocha/runner_mspec.coffee
325
316
  - spec/javascripts/teaspoon/mocha/spec_mspec.coffee
317
+ - spec/javascripts/teaspoon/other/erb_spec.js.coffee.erb
326
318
  - spec/javascripts/teaspoon/phantomjs/runner_spec.coffee
327
319
  - spec/javascripts/turbolinks_helper.coffee
328
320
  - spec/spec_helper.rb
@@ -339,6 +331,7 @@ test_files:
339
331
  - spec/teaspoon/formatters/base_formatter_spec.rb
340
332
  - spec/teaspoon/formatters/dot_formatter_spec.rb
341
333
  - spec/teaspoon/formatters/junit_formatter_spec.rb
334
+ - spec/teaspoon/formatters/pride_formatter_spec.rb
342
335
  - spec/teaspoon/formatters/tap_formatter_spec.rb
343
336
  - spec/teaspoon/formatters/tap_y_formatter_spec.rb
344
337
  - spec/teaspoon/formatters/teamcity_formatter_spec.rb
@@ -1,68 +0,0 @@
1
- system = require "system"
2
- webpage = require "webpage"
3
-
4
- class @Runner
5
-
6
- constructor: ->
7
- @url = system.args[1]
8
- @timeout = parseInt(system.args[2] || 180) * 1000 # todo: add configuration -- default timeout is 3 minutes
9
-
10
-
11
- run: ->
12
- @initPage()
13
- @loadPage()
14
-
15
-
16
- initPage: ->
17
- @page = webpage.create()
18
- @page.viewportSize = {width: 800, height: 800}
19
-
20
-
21
- loadPage: ->
22
- @page.open(@url)
23
- @page[name] = method for name, method of @pageCallbacks()
24
-
25
-
26
- waitForResults: =>
27
- @fail("Timed out") if (new Date().getTime() - @start) >= @timeout
28
- finished = @page.evaluate(-> window.Teaspoon && window.Teaspoon.finished)
29
- if finished then @finish() else setTimeout(@waitForResults, 200)
30
-
31
-
32
- fail: (msg = null, errno = 1) ->
33
- console.log("Error: #{msg}") if msg
34
- console.log(JSON.stringify(_teaspoon: true, type: "exception"))
35
- phantom.exit(errno)
36
-
37
-
38
- finish: ->
39
- console.log(" ")
40
- phantom.exit(0)
41
-
42
-
43
- pageCallbacks: ->
44
- onError: (message, trace) =>
45
- console.log(JSON.stringify(_teaspoon: true, type: "error", message: message, trace: trace))
46
- @errored = true
47
-
48
-
49
- onConsoleMessage: (msg) =>
50
- console.log(msg)
51
- clearTimeout(@errorTimeout) if @errorTimeout
52
- if @errored
53
- @errorTimeout = setTimeout((=> @fail('Javascript error has cause a timeout.')), 1000)
54
- @errored = false
55
-
56
-
57
- onLoadFinished: (status) =>
58
- return if @start
59
- @start = new Date().getTime()
60
- defined = @page.evaluate(-> window.Teaspoon)
61
- unless status == "success" && defined
62
- @fail("Failed to load: #{@url}")
63
- return
64
-
65
- @waitForResults()
66
-
67
-
68
- new Runner().run()