cleaned up js output

This commit is contained in:
Nick Gauthier 2010-05-28 10:51:27 -04:00
parent a69ae2e4ab
commit 727871117c
2 changed files with 8 additions and 6 deletions

View File

@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Nick Gauthier"]
s.date = %q{2010-05-24}
s.date = %q{2010-05-28}
s.description = %q{Spread your tests over multiple machines to test your code faster.}
s.email = %q{nick@smartlogicsolutions.com}
s.extra_rdoc_files = [
@ -32,6 +32,7 @@ Gem::Specification.new do |s|
"lib/hydra.rb",
"lib/hydra/cucumber/formatter.rb",
"lib/hydra/hash.rb",
"lib/hydra/js/lint.js",
"lib/hydra/listener/abstract.rb",
"lib/hydra/listener/minimal_output.rb",
"lib/hydra/listener/notifier.rb",
@ -59,6 +60,8 @@ Gem::Specification.new do |s|
"test/fixtures/features/write_alternate_file.feature",
"test/fixtures/features/write_file.feature",
"test/fixtures/hello_world.rb",
"test/fixtures/js_file.js",
"test/fixtures/json_data.json",
"test/fixtures/slow.rb",
"test/fixtures/sync_test.rb",
"test/fixtures/write_file.rb",

View File

@ -178,10 +178,8 @@ module Hydra #:nodoc:
end
def run_javascript_file(file)
puts "Running #{file}"
errors = []
require 'v8'
require 'pp' #TODO REMOVE!
V8::Context.open do |context|
context.load(File.expand_path(File.join(File.dirname(__FILE__), 'js', 'lint.js')))
context['input'] = lambda{
@ -190,9 +188,10 @@ module Hydra #:nodoc:
context['reportErrors'] = lambda{|js_errors|
js_errors.each do |e|
e = V8::To.ruby(e)
errors << "Error at line #{e['line'].to_i + 1} " +
"character #{e['character'].to_i + 1}: #{e['reason']}"
errors << e['evidence']
errors << "\n\e[1;31mJSLINT: #{file}\e[0m"
errors << " Error at line #{e['line'].to_i + 1} " +
"character #{e['character'].to_i + 1}: \e[1;33m#{e['reason']}\e[0m"
errors << "#{e['evidence']}"
end
}
context.eval %{