Compare commits
1 Commits
master
...
ssowonny/d
Author | SHA1 | Date | |
---|---|---|---|
|
00dd6e81f3 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -16,4 +16,3 @@ _site/
|
||||
jhw.*.html
|
||||
coverage/
|
||||
tmp/
|
||||
cache dir/
|
||||
|
12
Gemfile
12
Gemfile
@ -15,16 +15,22 @@ gem 'guard-cucumber'
|
||||
require 'rbconfig'
|
||||
case RbConfig::CONFIG['host_os']
|
||||
when /darwin/
|
||||
gem 'growl'
|
||||
gem 'rb-fsevent'
|
||||
when /linux/
|
||||
gem 'libnotify'
|
||||
end
|
||||
|
||||
gem 'mocha'
|
||||
gem 'growl'
|
||||
gem 'rake', '0.8.7'
|
||||
gem 'mocha', '0.9.12'
|
||||
gem 'guard-jasmine-headless-webkit', :git => 'git://github.com/johnbintz/guard-jasmine-headless-webkit.git'
|
||||
gem 'facter'
|
||||
|
||||
gem 'cucumber'
|
||||
|
||||
gem 'jquery-rails', '~> 1.0.0'
|
||||
gem 'jquery-rails'
|
||||
gem 'ejs'
|
||||
|
||||
gem 'guard-jasmine-headless-webkit', :git => 'git://github.com/johnbintz/guard-jasmine-headless-webkit.git'
|
||||
gem 'simplecov'
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
_This project is dead. You should use [Karma](http://karma-runner.github.io/) instead. I do._
|
||||
|
||||
# Jasmine Headless WebKit runner
|
||||
|
||||
Run your specs at sonic boom speed! No pesky reload button or page rendering slowdowns!
|
||||
|
2
Rakefile
2
Rakefile
@ -14,7 +14,7 @@ require 'jasmine/headless/task'
|
||||
|
||||
Jasmine::Headless::Task.new
|
||||
|
||||
PLATFORMS = %w{1.9.2 1.9.3}
|
||||
PLATFORMS = %w{1.8.7 1.9.2 ree 1.9.3}
|
||||
|
||||
def rvm_bundle(command = '')
|
||||
Bundler.with_clean_env do
|
||||
|
@ -1,2 +0,0 @@
|
||||
default: -r features
|
||||
|
@ -71,9 +71,7 @@ void Runner::loadSpec()
|
||||
outputFiles.enqueue(outputFile);
|
||||
}
|
||||
|
||||
QString runnerFile = runnerFiles.dequeue();
|
||||
|
||||
page.mainFrame()->load(runnerFile);
|
||||
page.mainFrame()->load(QUrl::fromLocalFile(runnerFiles.dequeue()));
|
||||
ticker.start();
|
||||
}
|
||||
|
||||
|
@ -7,9 +7,7 @@
|
||||
#include <QTextStream>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <QQueue>
|
||||
#include <QApplication>
|
||||
|
||||
#include "Page.h"
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
TEMPLATE = app
|
||||
CONFIG -= app_bundle
|
||||
QMAKE_INFO_PLIST = Info.plist
|
||||
QMAKESPEC = macx-g++
|
||||
QT += network webkit
|
||||
|
||||
SOURCES = Page.cpp Runner.cpp
|
||||
|
19
ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner.pro
Normal file
19
ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner.pro
Normal file
@ -0,0 +1,19 @@
|
||||
######################################################################
|
||||
# Automatically generated by qmake (2.01a) Tue Aug 2 10:37:48 2011
|
||||
######################################################################
|
||||
|
||||
TEMPLATE = app
|
||||
TARGET =
|
||||
DEPENDPATH += . HeadlessSpecRunner Test
|
||||
INCLUDEPATH += . HeadlessSpecRunner Test
|
||||
|
||||
# Input
|
||||
HEADERS += HeadlessSpecRunner/ConsoleOutput.h \
|
||||
HeadlessSpecRunner/Page.h \
|
||||
HeadlessSpecRunner/Runner.h \
|
||||
Test/Page_test.h
|
||||
SOURCES += specrunner.cpp \
|
||||
HeadlessSpecRunner/ConsoleOutput.cpp \
|
||||
HeadlessSpecRunner/Page.cpp \
|
||||
HeadlessSpecRunner/Runner.cpp \
|
||||
Test/Page_test.cpp
|
@ -23,10 +23,6 @@
|
||||
|
||||
#include "Runner.h"
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
|
||||
#error Use Qt 4.7 or later version
|
||||
#endif
|
||||
|
@ -1,7 +0,0 @@
|
||||
Feature: Bin - Two spec files with same basename
|
||||
Scenario: Run both files
|
||||
Given there is no existing "spec/report.txt" file
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/two_spec_files_same_basename/jasmine.yml -f File:spec/report.txt`
|
||||
Then the exit status should be 0
|
||||
And the report file "spec/report.txt" should have 2 total, 0 failures, no console usage
|
||||
|
@ -1,11 +0,0 @@
|
||||
Feature: Two files from source files
|
||||
Scenario: Files are ordered directly
|
||||
Given I have a test suite
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/two_files_from_src_files/jasmine.yml -l`
|
||||
Then the exit status should be 0
|
||||
And the following files should be loaded in order:
|
||||
| vendor/vendor-file.js |
|
||||
| vendor/vendor.js |
|
||||
| app/app-file.js |
|
||||
| app/app.js |
|
||||
|
@ -1,7 +0,0 @@
|
||||
Feature: Bin - With Server
|
||||
Scenario: Run using an HTTP server
|
||||
Given there is no existing "spec/report.txt" file
|
||||
When I run `bin/jasmine-headless-webkit --use-server -j spec/jasmine/success/success.yml -f File:spec/report.txt`
|
||||
Then the exit status should be 0
|
||||
And the report file "spec/report.txt" should have 1 total, 0 failures, no console usage
|
||||
|
@ -1,10 +0,0 @@
|
||||
Then /^the following files should be loaded in order:$/ do |table|
|
||||
files = table.raw.flatten
|
||||
|
||||
@output.lines.collect(&:strip).each do |line|
|
||||
files.shift if line[files.first]
|
||||
end
|
||||
|
||||
files.should be_empty
|
||||
end
|
||||
|
@ -20,11 +20,9 @@ Gem::Specification.new do |s|
|
||||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
||||
s.require_paths = ["lib"]
|
||||
|
||||
s.add_runtime_dependency 'jasmine-core'
|
||||
s.add_runtime_dependency 'jasmine-core', '~> 1.1'
|
||||
s.add_runtime_dependency 'coffee-script'
|
||||
s.add_runtime_dependency 'rainbow'
|
||||
s.add_runtime_dependency 'multi_json', '>= 1.2.0'
|
||||
s.add_runtime_dependency 'sprockets'
|
||||
s.add_runtime_dependency 'sprockets-vendor_gems'
|
||||
s.add_runtime_dependency 'multi_json'
|
||||
s.add_runtime_dependency 'sprockets', '~> 2'
|
||||
end
|
||||
|
||||
|
20
lib/digest/jasmine_test.rb
Normal file
20
lib/digest/jasmine_test.rb
Normal file
@ -0,0 +1,20 @@
|
||||
module Digest
|
||||
class JasmineTest
|
||||
def self.file(file)
|
||||
new
|
||||
end
|
||||
|
||||
def file(file)
|
||||
self
|
||||
end
|
||||
|
||||
def hexdigest
|
||||
'test'
|
||||
end
|
||||
|
||||
def update(prefix)
|
||||
self
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,3 +1,7 @@
|
||||
require 'jasmine/headless'
|
||||
require 'jasmine/headless/railtie' if defined?(Rails) && Rails::VERSION::MAJOR >= 3
|
||||
|
||||
module Digest
|
||||
autoload :JasmineTest, 'digest/jasmine_test'
|
||||
end
|
||||
|
||||
|
@ -8,6 +8,7 @@ module Jasmine
|
||||
autoload :CommandLine, 'jasmine/headless/command_line'
|
||||
|
||||
autoload :CoffeeScriptCache, 'jasmine/headless/coffee_script_cache'
|
||||
autoload :DustCache, 'jasmine/headless/dust_cache'
|
||||
autoload :SpecFileAnalyzer, 'jasmine/headless/spec_file_analyzer'
|
||||
autoload :CacheableAction, 'jasmine/headless/cacheable_action'
|
||||
autoload :VERSION, 'jasmine/headless/version'
|
||||
@ -23,6 +24,7 @@ module Jasmine
|
||||
autoload :FileChecker, 'jasmine/headless/file_checker'
|
||||
|
||||
autoload :CoffeeTemplate, 'jasmine/headless/coffee_template'
|
||||
autoload :DustTemplate, 'jasmine/headless/dust_template'
|
||||
autoload :JSTemplate, 'jasmine/headless/js_template'
|
||||
autoload :JSTTemplate, 'jasmine/headless/jst_template'
|
||||
autoload :CSSTemplate, 'jasmine/headless/css_template'
|
||||
|
@ -54,11 +54,7 @@ module Jasmine::Headless
|
||||
end
|
||||
|
||||
def cache_file
|
||||
@cache_file ||= File.expand_path(relative_cache_file) + '.js'
|
||||
end
|
||||
|
||||
def relative_cache_file
|
||||
File.join(self.class.cache_dir, self.class.cache_type, file.gsub(Dir.pwd + '/', ''))
|
||||
@cache_file ||= File.expand_path(File.join(self.class.cache_dir, self.class.cache_type, file)) + '.js'
|
||||
end
|
||||
|
||||
def fresh?
|
||||
|
30
lib/jasmine/headless/dust_cache.rb
Normal file
30
lib/jasmine/headless/dust_cache.rb
Normal file
@ -0,0 +1,30 @@
|
||||
require 'execjs'
|
||||
require 'digest/sha1'
|
||||
require 'fileutils'
|
||||
|
||||
module Jasmine
|
||||
module Headless
|
||||
|
||||
class DustCache < CacheableAction
|
||||
|
||||
class << self
|
||||
def cache_type
|
||||
"dust"
|
||||
end
|
||||
end
|
||||
|
||||
def action
|
||||
@path ||= File.expand_path('../../../../vendor/assets/javascripts/dust-full-for-compile.js', __FILE__)
|
||||
@contents ||= File.read(@path)
|
||||
@context ||= ExecJS.compile(@contents)
|
||||
|
||||
template_root = DustTemplate.template_root
|
||||
template_root = template_root + '/' if template_root[ template_root.length - 1 ].chr != '/'
|
||||
template_name = file.split(template_root).last.split('.',2).first
|
||||
@context.call("dust.compile", File.read(file), template_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
41
lib/jasmine/headless/dust_template.rb
Normal file
41
lib/jasmine/headless/dust_template.rb
Normal file
@ -0,0 +1,41 @@
|
||||
require 'tilt/template'
|
||||
require 'execjs'
|
||||
|
||||
module Jasmine::Headless
|
||||
class DustTemplate < Tilt::Template
|
||||
include Jasmine::Headless::FileChecker
|
||||
|
||||
class << self
|
||||
def template_root=(root)
|
||||
@template_root = root
|
||||
end
|
||||
def template_root
|
||||
@template_root || "app/assets/javascripts/templates/"
|
||||
end
|
||||
end
|
||||
|
||||
self.default_mime_type = 'application/javascript'
|
||||
|
||||
def prepare; end
|
||||
|
||||
def evaluate(scope, locals, &block)
|
||||
if bad_format?(file)
|
||||
alert_bad_format(file)
|
||||
return ''
|
||||
end
|
||||
begin
|
||||
cache = Jasmine::Headless::DustCache.new(file)
|
||||
source = cache.handle
|
||||
if cache.cached?
|
||||
%{<script type="text/javascript" src="#{cache.cache_file}"></script>
|
||||
<script type="text/javascript">window.CSTF['#{File.split(cache.cache_file).last}'] = '#{file}';</script>}
|
||||
else
|
||||
%{<script type="text/javascript">#{source}</script>}
|
||||
end
|
||||
rescue StandardError => e
|
||||
puts "[%s] Error in compiling file: %s" % [ 'coffeescript'.color(:red), file.color(:yellow) ]
|
||||
raise e
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -4,7 +4,6 @@ require 'multi_json'
|
||||
require 'set'
|
||||
require 'sprockets'
|
||||
require 'sprockets/engines'
|
||||
require 'sprockets-vendor_gems'
|
||||
|
||||
module Jasmine::Headless
|
||||
class FilesList
|
||||
@ -12,12 +11,33 @@ module Jasmine::Headless
|
||||
|
||||
class << self
|
||||
def asset_paths
|
||||
@asset_paths ||= Sprockets.find_gem_vendor_paths(:for => 'javascripts')
|
||||
return @asset_paths if @asset_paths
|
||||
|
||||
require 'rubygems'
|
||||
|
||||
raise StandardError.new("A newer version of Rubygems is required to use vendored assets. Please upgrade.") if !Gem::Specification.respond_to?(:each)
|
||||
|
||||
@asset_paths = []
|
||||
|
||||
Gem::Specification.each { |gemspec| @asset_paths += get_paths_from_gemspec(gemspec) }
|
||||
|
||||
@asset_paths
|
||||
end
|
||||
|
||||
def get_paths_from_gemspec(gemspec)
|
||||
%w{vendor lib app}.collect do |dir|
|
||||
path = File.join(gemspec.gem_dir, dir, "assets/javascripts")
|
||||
|
||||
if File.directory?(path) && !@asset_paths.include?(path)
|
||||
path
|
||||
else
|
||||
nil
|
||||
end
|
||||
end.compact
|
||||
end
|
||||
|
||||
def reset!
|
||||
@asset_paths = nil
|
||||
@registered_engines = {}
|
||||
|
||||
# register haml-sprockets and handlebars_assets if it's available...
|
||||
%w{haml-sprockets handlebars_assets}.each do |library|
|
||||
@ -36,20 +56,17 @@ module Jasmine::Headless
|
||||
end
|
||||
end
|
||||
|
||||
@sprockets_environment = nil
|
||||
end
|
||||
# ...and unregister ones we don't want/need
|
||||
Sprockets.instance_eval do
|
||||
EXCLUDED_FORMATS.each do |extension|
|
||||
register_engine ".#{extension}", Jasmine::Headless::NilTemplate
|
||||
end
|
||||
|
||||
def registered_engines
|
||||
@registered_engines ||= {}
|
||||
end
|
||||
|
||||
def register_engine(file_extension, template_class)
|
||||
registered_engines[file_extension] = template_class
|
||||
end
|
||||
|
||||
def register_engines!
|
||||
registered_engines.each do |file_extension, template_class|
|
||||
Sprockets.register_engine file_extension, template_class
|
||||
register_engine '.coffee', Jasmine::Headless::CoffeeTemplate
|
||||
register_engine '.js', Jasmine::Headless::JSTemplate
|
||||
register_engine '.css', Jasmine::Headless::CSSTemplate
|
||||
register_engine '.jst', Jasmine::Headless::JSTTemplate
|
||||
register_engine '.dust', Jasmine::Headless::DustTemplate
|
||||
end
|
||||
end
|
||||
|
||||
@ -79,21 +96,11 @@ module Jasmine::Headless
|
||||
@required_files = UniqueAssetList.new
|
||||
@potential_files_to_filter = []
|
||||
|
||||
register_engines!
|
||||
|
||||
load_initial_assets
|
||||
|
||||
use_config if config?
|
||||
end
|
||||
|
||||
def register_engines!
|
||||
begin
|
||||
require spec_helper
|
||||
rescue LoadError
|
||||
end
|
||||
self.class.register_engines!
|
||||
end
|
||||
|
||||
def load_initial_assets
|
||||
self.class.default_files.each do |file|
|
||||
begin
|
||||
@ -131,7 +138,6 @@ module Jasmine::Headless
|
||||
@search_paths += asset_paths.collect { |dir| File.expand_path(dir) }
|
||||
@search_paths += spec_dir.collect { |dir| File.expand_path(dir) }
|
||||
|
||||
@search_paths.uniq!
|
||||
@search_paths
|
||||
end
|
||||
|
||||
@ -142,19 +148,6 @@ module Jasmine::Headless
|
||||
search_paths.each { |path| @sprockets_environment.append_path(path) }
|
||||
|
||||
@sprockets_environment.unregister_postprocessor('application/javascript', Sprockets::SafetyColons)
|
||||
|
||||
# ...and unregister ones we don't want/need
|
||||
@sprockets_environment.instance_eval do
|
||||
EXCLUDED_FORMATS.each do |extension|
|
||||
register_engine ".#{extension}", Jasmine::Headless::NilTemplate
|
||||
end
|
||||
|
||||
register_engine '.coffee', Jasmine::Headless::CoffeeTemplate
|
||||
register_engine '.js', Jasmine::Headless::JSTemplate
|
||||
register_engine '.css', Jasmine::Headless::CSSTemplate
|
||||
register_engine '.jst', Jasmine::Headless::JSTTemplate
|
||||
end
|
||||
|
||||
@sprockets_environment
|
||||
end
|
||||
|
||||
@ -232,16 +225,19 @@ module Jasmine::Headless
|
||||
add_files(@searches[type] = data.flatten, type, send(SEARCH_ROOTS[type]))
|
||||
end
|
||||
end
|
||||
|
||||
# config dust template
|
||||
Jasmine::Headless::DustTemplate.template_root = @config['template_dir']
|
||||
end
|
||||
|
||||
def add_files(patterns, type, dirs)
|
||||
patterns.each do |pattern|
|
||||
dirs.collect { |dir| expanded_dir(File.join(dir, pattern)) }.each do |files|
|
||||
files.sort! { |a, b| Kernel.rand(3) - 1 } if type == 'spec_files'
|
||||
dirs.product(patterns).each do |search|
|
||||
files = expanded_dir(File.join(*search))
|
||||
|
||||
files.each do |path|
|
||||
add_path(path, type)
|
||||
end
|
||||
files.sort! { |a, b| Kernel.rand(3) - 1 } if type == 'spec_files'
|
||||
|
||||
files.each do |path|
|
||||
add_path(path, type)
|
||||
end
|
||||
end
|
||||
|
||||
@ -255,8 +251,7 @@ module Jasmine::Headless
|
||||
end
|
||||
|
||||
def expanded_dir(path)
|
||||
file_list = Dir.glob(path).sort
|
||||
file_list.find_all { |file|
|
||||
Dir[path].find_all { |file|
|
||||
file[extension_filter] && !alert_if_bad_format?(file)
|
||||
}.collect {
|
||||
|file| File.expand_path(file)
|
||||
@ -280,7 +275,7 @@ module Jasmine::Headless
|
||||
end
|
||||
|
||||
def src_dir
|
||||
@src_dir ||= config_dir_or_pwd('src_dir') + asset_paths
|
||||
@src_dir ||= config_dir_or_pwd('src_dir')
|
||||
end
|
||||
|
||||
def spec_dir
|
||||
@ -288,7 +283,7 @@ module Jasmine::Headless
|
||||
end
|
||||
|
||||
def asset_paths
|
||||
@asset_paths ||= config_dir('asset_paths')
|
||||
@asset_paths ||= config_dir_or_pwd('asset_paths')
|
||||
end
|
||||
|
||||
def spec_file_searches
|
||||
@ -296,15 +291,9 @@ module Jasmine::Headless
|
||||
end
|
||||
|
||||
def config_dir_or_pwd(dir)
|
||||
if (found = config_dir(dir)).empty?
|
||||
found = [ Dir.pwd ]
|
||||
end
|
||||
found_dir = (@options[:config] && @options[:config][dir]) || Dir.pwd
|
||||
|
||||
found
|
||||
end
|
||||
|
||||
def config_dir(dir)
|
||||
[ @options[:config] && @options[:config][dir] ].flatten.compact.collect { |dir| File.expand_path(dir) }
|
||||
[ found_dir ].flatten.collect { |dir| File.expand_path(dir) }
|
||||
end
|
||||
|
||||
def filter_for_requested_specs(files)
|
||||
@ -316,17 +305,5 @@ module Jasmine::Headless
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def spec_helper
|
||||
File.join(spec_dir, "helpers", "spec_helper")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module Jasmine::Headless
|
||||
extend self
|
||||
|
||||
def register_engine(file_extension, template_class)
|
||||
Jasmine::Headless::FilesList.register_engine(file_extension, template_class)
|
||||
end
|
||||
end
|
||||
|
@ -18,9 +18,7 @@ module Jasmine
|
||||
:enable_cache => true,
|
||||
:files => [],
|
||||
:reporters => [ [ 'Console' ] ],
|
||||
:quiet => false,
|
||||
:use_server => false,
|
||||
:server_port => nil
|
||||
:quiet => false
|
||||
}
|
||||
|
||||
DEFAULTS_FILE = File.join(Dir.pwd, '.jasmine-headless-webkit')
|
||||
@ -77,10 +75,6 @@ module Jasmine
|
||||
@options[:seed] = arg.to_i
|
||||
when '--format', '-f'
|
||||
add_reporter(arg)
|
||||
when '--use-server'
|
||||
@options[:use_server] = true
|
||||
when '--server-port'
|
||||
@options[:server_port] = arg.to_i
|
||||
when '--out'
|
||||
add_reporter_file(arg)
|
||||
when '-h', '--help'
|
||||
@ -113,8 +107,6 @@ module Jasmine
|
||||
[ '--seed', GetoptLong::REQUIRED_ARGUMENT ],
|
||||
[ '--format', '-f', GetoptLong::REQUIRED_ARGUMENT ],
|
||||
[ '--out', GetoptLong::REQUIRED_ARGUMENT ],
|
||||
[ '--use-server', GetoptLong::NO_ARGUMENT ],
|
||||
[ '--server-port', GetoptLong::REQUIRED_ARGUMENT ],
|
||||
[ '-h', '--help', GetoptLong::NO_ARGUMENT ],
|
||||
[ '-q', '--quiet', GetoptLong::NO_ARGUMENT ]
|
||||
)
|
||||
@ -173,9 +165,8 @@ module Jasmine
|
||||
[ '--runner-out <filename>', 'Write runner to specified filename' ],
|
||||
[ '-j, --jasmine-config <config file>', 'Jasmine Yaml config to use' ],
|
||||
[ '--no-full-run', 'Do not perform a full spec run after a successful targeted spec run' ],
|
||||
[ '--use-server', 'Load tests from an HTTP server instead of from filesystem' ],
|
||||
[ '-l, --list', 'List files in the order they will be required' ],
|
||||
[ '--seed <seed>', 'Random order seed for spec file ordering' ],
|
||||
[ '--seed', 'Random order seed for spec file ordering' ],
|
||||
[ '-f, --format <reporter<:filename>>', 'Specify an output reporter and possibly output filename' ],
|
||||
[ '--out <filename>', 'Specify output filename for last defined reporter' ],
|
||||
[ '-q, --quiet', "Silence most non-test related warnings" ],
|
||||
|
@ -7,26 +7,9 @@ require 'yaml'
|
||||
require 'erb'
|
||||
require 'sprockets'
|
||||
|
||||
|
||||
module Jasmine
|
||||
module Headless
|
||||
class IndexHandler
|
||||
class << self
|
||||
attr_accessor :index
|
||||
end
|
||||
|
||||
def initialize(app)
|
||||
@app = app
|
||||
end
|
||||
|
||||
def call(env)
|
||||
if env['PATH_INFO'] == '/'
|
||||
return [ 302, { 'Location' => self.class.index }, [ 'Redirecting...' ] ]
|
||||
end
|
||||
|
||||
@app.call(env)
|
||||
end
|
||||
end
|
||||
|
||||
class Runner
|
||||
JASMINE_DEFAULTS = {
|
||||
'spec_files' => [ '**/*[sS]pec.js' ],
|
||||
@ -43,103 +26,9 @@ module Jasmine
|
||||
|
||||
attr_reader :options
|
||||
|
||||
def self.run(options = {})
|
||||
new(options).run
|
||||
end
|
||||
|
||||
def self.server_port
|
||||
return @server_port if @server_port
|
||||
|
||||
require 'socket'
|
||||
|
||||
count = 100
|
||||
begin
|
||||
port = select_server_port
|
||||
|
||||
socket = TCPSocket.new(server_interface, port)
|
||||
socket.close
|
||||
|
||||
count -= 1
|
||||
|
||||
raise "Could not create server port after 100 attempts!" if count == 0
|
||||
rescue Errno::ECONNREFUSED
|
||||
@server_port = port
|
||||
|
||||
break
|
||||
ensure
|
||||
begin
|
||||
socket.close if socket
|
||||
rescue IOError
|
||||
end
|
||||
end while true
|
||||
|
||||
@server_port
|
||||
end
|
||||
|
||||
def self.server_port=(port)
|
||||
@server_port = port
|
||||
end
|
||||
|
||||
def self.select_server_port
|
||||
21000 + rand(10000)
|
||||
end
|
||||
|
||||
def self.server_interface
|
||||
'127.0.0.1'
|
||||
end
|
||||
|
||||
def self.server_uri
|
||||
"http://#{server_interface}:#{server_port}"
|
||||
end
|
||||
|
||||
def self.server_spec_path
|
||||
self.server_uri + '/__JHW__/'
|
||||
end
|
||||
|
||||
def self.ensure_server(options)
|
||||
return if @server
|
||||
|
||||
require 'webrick'
|
||||
require 'thread'
|
||||
require 'rack'
|
||||
require 'net/http'
|
||||
|
||||
port = server_port
|
||||
|
||||
@server = Thread.new do
|
||||
Jasmine::Headless.warn "Powering up!"
|
||||
|
||||
app = Rack::Builder.new do
|
||||
use IndexHandler
|
||||
|
||||
map '/__JHW__' do
|
||||
run Rack::File.new(Dir.pwd)
|
||||
end
|
||||
|
||||
map '/' do
|
||||
run Rack::File.new('/')
|
||||
end
|
||||
end
|
||||
|
||||
Rack::Handler::WEBrick.run(
|
||||
app,
|
||||
:Port => port,
|
||||
:Logger => Logger.new(StringIO.new),
|
||||
:AccessLog => [
|
||||
[ StringIO.new, WEBrick::AccessLog::COMMON_LOG_FORMAT ],
|
||||
[ StringIO.new, WEBrick::AccessLog::REFERER_LOG_FORMAT ]
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
while true do
|
||||
begin
|
||||
Net::HTTP.get(URI(server_uri))
|
||||
break
|
||||
rescue Errno::ECONNREFUSED => e
|
||||
end
|
||||
|
||||
sleep 0.1
|
||||
class << self
|
||||
def run(options = {})
|
||||
new(options).run
|
||||
end
|
||||
end
|
||||
|
||||
@ -174,7 +63,8 @@ module Jasmine
|
||||
command << "-r #{file}"
|
||||
end
|
||||
|
||||
command += targets
|
||||
command += targets.flatten.collect { |target| File.expand_path(target) }
|
||||
|
||||
command.compact.join(' ')
|
||||
end
|
||||
|
||||
@ -183,11 +73,9 @@ module Jasmine
|
||||
Jasmine::Headless.show_warnings = !@options[:quiet]
|
||||
FilesList.reset!
|
||||
|
||||
self.class.server_port = options[:server_port]
|
||||
|
||||
@_targets = template_writer.write
|
||||
|
||||
run_targets = absolute_run_targets(@_targets.dup)
|
||||
run_targets = @_targets.dup
|
||||
|
||||
if run_targets.length == 2
|
||||
if (!@options[:full_run] && files_list.filtered?) || files_list.has_spec_outside_scope?
|
||||
@ -195,13 +83,7 @@ module Jasmine
|
||||
end
|
||||
end
|
||||
|
||||
runner = lambda { system jasmine_command(run_targets) }
|
||||
|
||||
if options[:use_server]
|
||||
wrap_in_server(run_targets, &runner)
|
||||
else
|
||||
runner.call
|
||||
end
|
||||
system jasmine_command(run_targets)
|
||||
|
||||
@_status = $?.exitstatus
|
||||
ensure
|
||||
@ -210,17 +92,6 @@ module Jasmine
|
||||
end
|
||||
end
|
||||
|
||||
def absolute_run_targets(targets)
|
||||
targets.flatten.collect do |target|
|
||||
if options[:use_server]
|
||||
target = self.class.server_spec_path + target
|
||||
else
|
||||
target = "file://" + File.expand_path(target)
|
||||
end
|
||||
target
|
||||
end
|
||||
end
|
||||
|
||||
def runner_filename
|
||||
options[:runner_output_filename] || begin
|
||||
if (runner_output = jasmine_config['runner_output']) && !runner_output.empty?
|
||||
@ -240,15 +111,6 @@ module Jasmine
|
||||
)
|
||||
end
|
||||
|
||||
def wrap_in_server(run_targets)
|
||||
self.class.ensure_server(options)
|
||||
IndexHandler.index = run_targets.last
|
||||
|
||||
Jasmine::Headless.warn "HTTP powered specs! Located at #{run_targets.join(' ')}"
|
||||
|
||||
yield
|
||||
end
|
||||
|
||||
private
|
||||
def jasmine_config_data
|
||||
raise JasmineConfigNotFound.new("Jasmine config not found. I tried #{@options[:jasmine_config]}.") if !File.file?(@options[:jasmine_config])
|
||||
|
@ -33,11 +33,11 @@ module Jasmine::Headless
|
||||
end
|
||||
|
||||
def serialize(data)
|
||||
MultiJson.dump(data)
|
||||
MultiJson.encode(data)
|
||||
end
|
||||
|
||||
def unserialize(data)
|
||||
MultiJson.load(data)
|
||||
MultiJson.decode(data)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -14,9 +14,23 @@ module Jasmine
|
||||
|
||||
desc 'Run Jasmine specs headlessly'
|
||||
task(name) { run_rake_task }
|
||||
|
||||
create_rails_compliant_task if defined?(Rails)
|
||||
end
|
||||
|
||||
private
|
||||
def create_rails_compliant_task
|
||||
if Rails.respond_to?(:version) && Rails.version >= "3.1.0"
|
||||
task 'assets:precompile:for_testing' => :environment do
|
||||
$stderr.puts "This task is deprecated and will be removed after 2012-01-01"
|
||||
|
||||
Rails.application.assets.digest_class = Digest::JasmineTest
|
||||
|
||||
Rake::Task['assets:precompile'].invoke
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def run_rake_task
|
||||
case Jasmine::Headless::Runner.run(
|
||||
:colors => colors,
|
||||
|
@ -24,9 +24,7 @@ module Jasmine::Headless
|
||||
output.unshift([filtered_tests_filename, files_list.filtered_files_to_html ]) if files_list.filtered?
|
||||
|
||||
output.each do |name, files|
|
||||
template = template_for(files)
|
||||
|
||||
File.open(name, 'wb') { |fh| fh.print template }
|
||||
File.open(name, 'w') { |fh| fh.print template_for(files) }
|
||||
end
|
||||
|
||||
output.collect(&:first)
|
||||
|
@ -3,7 +3,7 @@ module Jasmine::Headless
|
||||
def <<(asset)
|
||||
raise InvalidUniqueAsset.new("Not an asset: #{asset.inspect}") if !asset.respond_to?(:logical_path)
|
||||
|
||||
super if !self.any? { |other| asset.pathname == other.pathname }
|
||||
super if !self.any? { |other| asset.logical_path == other.logical_path }
|
||||
end
|
||||
|
||||
def flatten
|
||||
|
@ -1,5 +1,5 @@
|
||||
module Jasmine
|
||||
module Headless
|
||||
VERSION = "0.9.0.rc.2"
|
||||
VERSION = "0.8.4"
|
||||
end
|
||||
end
|
||||
|
@ -6,7 +6,7 @@
|
||||
<script type="text/javascript" src="<%= Jasmine::Headless.root.join('vendor/assets/javascripts/prolog.js') %>"></script>
|
||||
<%= files.join("\n") %>
|
||||
<script type="text/javascript">
|
||||
if (window.JHW) { HeadlessReporterResult.specLineNumbers = <%= MultiJson.dump(spec_lines) %>; }
|
||||
if (window.JHW) { HeadlessReporterResult.specLineNumbers = <%= MultiJson.encode(spec_lines) %>; }
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
@ -34,39 +34,6 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var location = window.location.href;
|
||||
|
||||
var getLastModified = function(callback) {
|
||||
var http = new XMLHttpRequest();
|
||||
var header;
|
||||
|
||||
http.open('HEAD', location, true);
|
||||
|
||||
http.onreadystatechange = function() {
|
||||
if(http.readyState === http.DONE) {
|
||||
callback(http.getResponseHeader('Last-Modified'));
|
||||
}
|
||||
};
|
||||
http.send();
|
||||
}
|
||||
|
||||
getLastModified(function(currentLastModified) {
|
||||
var checker;
|
||||
checker = function() {
|
||||
setTimeout(function() {
|
||||
getLastModified(function(newLastModified) {
|
||||
if (currentLastModified != newLastModified) {
|
||||
setTimeout(function() { window.location.reload(); }, 1000);
|
||||
} else {
|
||||
checker();
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
};
|
||||
|
||||
checker();
|
||||
});
|
||||
}
|
||||
|
||||
jasmine.getEnv().execute();
|
||||
|
@ -1,2 +0,0 @@
|
||||
//= require app-file
|
||||
//
|
@ -1,7 +0,0 @@
|
||||
src_dir: spec/jasmine/two_files_from_src_files/app
|
||||
|
||||
asset_paths:
|
||||
- "spec/jasmine/two_files_from_src_files/vendor"
|
||||
|
||||
src_files: [ 'vendor.js', 'app.js' ]
|
||||
|
@ -1,2 +0,0 @@
|
||||
//= require vendor-file
|
||||
//
|
@ -1,6 +0,0 @@
|
||||
src_dir: spec/jasmine/two_spec_files_same_basename
|
||||
src_files: []
|
||||
|
||||
spec_dir: spec/jasmine/two_spec_files_same_basename
|
||||
spec_files: [ "**/*.{js,coffee}" ]
|
||||
|
@ -1,4 +0,0 @@
|
||||
describe 'two', ->
|
||||
it 'should pass', ->
|
||||
expect(true).toEqual(true)
|
||||
|
@ -1,6 +0,0 @@
|
||||
describe("one", function() {
|
||||
it('should pass', function() {
|
||||
expect(true).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
@ -95,28 +95,5 @@ describe Jasmine::Headless::CacheableAction do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#relative_cache_file' do
|
||||
context 'file is an absolute windows file' do
|
||||
let(:current_path) { 'C:/path' }
|
||||
let(:filename) { "file.coffee" }
|
||||
let(:windows_path) { File.join(current_path, filename) }
|
||||
let(:cache_dir) { 'cache dir' }
|
||||
let(:cache_type) { 'cache type' }
|
||||
|
||||
before do
|
||||
cache_object.stubs(:file).returns(windows_path)
|
||||
|
||||
described_class.stubs(:cache_dir).returns(cache_dir)
|
||||
described_class.stubs(:cache_type).returns(cache_type)
|
||||
|
||||
Dir.stubs(:pwd).returns(current_path)
|
||||
end
|
||||
|
||||
subject { cache_object.relative_cache_file }
|
||||
|
||||
it { should == File.join(cache_dir, cache_type, filename) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -5,6 +5,50 @@ require 'coffee-script'
|
||||
describe Jasmine::Headless::FilesList do
|
||||
let(:files_list) { described_class.new }
|
||||
|
||||
describe '.get_paths_from_gemspec' do
|
||||
include FakeFS::SpecHelpers
|
||||
|
||||
let(:gem_dir) { "dir" }
|
||||
let(:gemspec) { stub(:gem_dir => gem_dir) }
|
||||
|
||||
let(:paths) do
|
||||
%w{vendor lib app}.collect do |dir|
|
||||
File.join(gem_dir, dir, 'assets/javascripts')
|
||||
end
|
||||
end
|
||||
|
||||
before do
|
||||
paths.each { |path| FileUtils.mkdir_p path }
|
||||
|
||||
described_class.instance_variable_set(:@asset_paths, [])
|
||||
end
|
||||
|
||||
subject { described_class.get_paths_from_gemspec(gemspec) }
|
||||
|
||||
it { should =~ paths }
|
||||
end
|
||||
|
||||
describe '.asset_paths' do
|
||||
include FakeFS::SpecHelpers
|
||||
|
||||
let(:dir_one) { 'dir_one' }
|
||||
let(:dir_two) { 'dir_two' }
|
||||
|
||||
let(:gem_one) { stub(:gem_dir => dir_one) }
|
||||
let(:gem_two) { stub(:gem_dir => dir_two) }
|
||||
|
||||
before do
|
||||
described_class.instance_variable_set(:@asset_paths, nil)
|
||||
FileUtils.mkdir_p File.join(dir_two, 'vendor/assets/javascripts')
|
||||
|
||||
Gem::Specification.stubs(:_all).returns([gem_one, gem_two])
|
||||
end
|
||||
|
||||
it 'should return all matching gems with vendor/assets/javascripts directories' do
|
||||
described_class.asset_paths.should == [ File.join(dir_two, 'vendor/assets/javascripts') ]
|
||||
end
|
||||
end
|
||||
|
||||
describe '#initialize' do
|
||||
before do
|
||||
described_class.any_instance.stubs(:load_initial_assets)
|
||||
@ -174,21 +218,6 @@ describe Jasmine::Headless::FilesList do
|
||||
files_list.files.any? { |file| file['.erb'] }.should be_false
|
||||
end
|
||||
end
|
||||
|
||||
describe "#register_engine!" do
|
||||
|
||||
before(:each) do
|
||||
Jasmine::Headless::FilesList.reset!
|
||||
end
|
||||
|
||||
it "should register code added via configure blocks" do
|
||||
template_class = mock()
|
||||
described_class.register_engine ".foo", template_class
|
||||
Sprockets.expects(:register_engine).with(".foo", template_class)
|
||||
described_class.new
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -194,54 +194,4 @@ describe Jasmine::Headless::Runner do
|
||||
subject.options[:reporters].should == reporters
|
||||
end
|
||||
end
|
||||
|
||||
describe '.server_port' do
|
||||
before do
|
||||
described_class.instance_variable_set(:@server_port, nil)
|
||||
end
|
||||
|
||||
context 'port in use' do
|
||||
require 'socket'
|
||||
|
||||
before do
|
||||
described_class.stubs(:select_server_port).returns(5000, 5001)
|
||||
end
|
||||
|
||||
it 'should try another port' do
|
||||
server = TCPServer.new(described_class.server_interface, 5000)
|
||||
|
||||
described_class.server_port.should == 5001
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#absolute_run_targets' do
|
||||
let(:opts) { {} }
|
||||
|
||||
subject { runner.absolute_run_targets(targets) }
|
||||
|
||||
let(:targets) { [ target ] }
|
||||
let(:target) { 'target' }
|
||||
|
||||
before do
|
||||
runner.stubs(:options).returns(:use_server => use_server)
|
||||
end
|
||||
|
||||
context 'server' do
|
||||
let(:use_server) { true }
|
||||
let(:server_spec_path) { 'server spec path' }
|
||||
|
||||
before do
|
||||
described_class.stubs(:server_spec_path).returns(server_spec_path)
|
||||
end
|
||||
|
||||
it { should == [ server_spec_path + target ] }
|
||||
end
|
||||
|
||||
context 'no server' do
|
||||
let(:use_server) { false }
|
||||
|
||||
it { should == [ 'file://' + File.expand_path(target) ] }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -3,9 +3,9 @@ require 'spec_helper'
|
||||
describe Jasmine::Headless::UniqueAssetList do
|
||||
let(:list) { described_class.new }
|
||||
|
||||
let(:first) { stub(:logical_path => 'one', :pathname => 'one') }
|
||||
let(:second) { stub(:logical_path => 'two', :pathname => 'two') }
|
||||
let(:third) { stub(:logical_path => 'two', :pathname => 'two') }
|
||||
let(:first) { stub(:logical_path => 'one') }
|
||||
let(:second) { stub(:logical_path => 'two') }
|
||||
let(:third) { stub(:logical_path => 'two') }
|
||||
|
||||
it 'should raise an exception on a non-asset' do
|
||||
expect { list << "whatever" }.to raise_error(StandardError)
|
||||
|
@ -11,16 +11,16 @@ window.Intense = {
|
||||
methods:
|
||||
foreground: (color) ->
|
||||
if Intense.useColors
|
||||
'\x1b' + "[3#{Intense.colors[color]}m#{this}" + '\x1b' + "[0m"
|
||||
"\033[3#{Intense.colors[color]}m#{this}\033[0m"
|
||||
else
|
||||
this
|
||||
bright: ->
|
||||
if Intense.useColors
|
||||
'\x1b' + "[1m#{this}" + '\x1b' + "[0m"
|
||||
"\033[1m#{this}\033[0m"
|
||||
else
|
||||
this
|
||||
useColors: true
|
||||
moveBack: (count = 1) -> '\x1b' + "[#{count}D"
|
||||
moveBack: (count = 1) -> "\033[#{count}D"
|
||||
}
|
||||
|
||||
for method, code of Intense.methods
|
@ -30,7 +30,15 @@ if window.JHW
|
||||
this.env.reporter.reportSpecResults(this)
|
||||
|
||||
jasmine.Spec.prototype.fail = (e) ->
|
||||
e = JHW.createCoffeeScriptFileException(e)
|
||||
if e and e.sourceURL and window.CoffeeScriptToFilename
|
||||
filename = e.sourceURL.split('/').pop()
|
||||
if realFilename = window.CoffeeScriptToFilename[filename]
|
||||
e = {
|
||||
name: e.name,
|
||||
message: e.message,
|
||||
lineNumber: "~" + String(e.line),
|
||||
sourceURL: realFilename
|
||||
}
|
||||
|
||||
expectationResult = new jasmine.ExpectationResult({
|
||||
passed: false,
|
||||
@ -39,8 +47,6 @@ if window.JHW
|
||||
})
|
||||
@results_.addResult(expectationResult)
|
||||
|
||||
this.env.reporter.reportException(e)
|
||||
|
||||
jasmine.NestedResults.isValidSpecLine = (line) ->
|
||||
line.match(/^\s*expect/) != null || line.match(/^\s*return\s*expect/) != null
|
||||
|
||||
@ -86,7 +92,7 @@ if window.JHW
|
||||
|
||||
this.addResult_(result)
|
||||
|
||||
for method in [ "reportSpecWaiting", "reportSpecRunning", "reportException" ]
|
||||
for method in [ "reportSpecWaiting", "reportSpecRunning" ]
|
||||
generator = (method) ->
|
||||
(args...) ->
|
||||
for reporter in @subReporters_
|
@ -1,4 +1,4 @@
|
||||
#= require jasmine.HeadlessReporter
|
||||
#= require jasmine.HeadlessReporter.js
|
||||
|
||||
class jasmine.HeadlessReporter.ConsoleBase extends jasmine.HeadlessReporter
|
||||
constructor: (@callback = null) ->
|
@ -1,4 +1,4 @@
|
||||
#= require jasmine.HeadlessReporter
|
||||
#= require jasmine.HeadlessReporter.js
|
||||
#
|
||||
class jasmine.HeadlessReporter.File extends jasmine.HeadlessReporter
|
||||
reportRunnerResults: (runner) ->
|
@ -1,4 +1,4 @@
|
||||
#= require jasmine.HeadlessReporter
|
||||
#= require jasmine.HeadlessReporter.js
|
||||
|
||||
class jasmine.HeadlessReporter.Tap extends jasmine.HeadlessReporter
|
||||
constructor: (@outputTarget = null) ->
|
26
vendor/assets/coffeescripts/jasmine.HeadlessReporter.Verbose.coffee
vendored
Normal file
26
vendor/assets/coffeescripts/jasmine.HeadlessReporter.Verbose.coffee
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
#= require jasmine.HeadlessReporter.ConsoleBase
|
||||
#
|
||||
class jasmine.HeadlessReporter.Verbose extends jasmine.HeadlessReporter.ConsoleBase
|
||||
displaySuccess: (spec) =>
|
||||
this.displaySpec(spec, 'green')
|
||||
|
||||
displayFailure: (spec) =>
|
||||
this.displaySpec(spec, 'red')
|
||||
|
||||
displaySpec: (spec, color) =>
|
||||
currentLastNames = (@lastNames || []).slice(0)
|
||||
@lastNames = spec.getSpecSplitName()
|
||||
|
||||
this.puts(this.indentSpec(@lastNames, currentLastNames, color).join("\n"))
|
||||
|
||||
indentSpec: (current, last, color) =>
|
||||
last = last.slice(0)
|
||||
|
||||
output = []
|
||||
|
||||
indent = ''
|
||||
for name in current
|
||||
output.push(indent + name.foreground(color)) if last.shift() != name
|
||||
indent += ' '
|
||||
|
||||
output
|
16
vendor/assets/coffeescripts/prolog.coffee
vendored
16
vendor/assets/coffeescripts/prolog.coffee
vendored
@ -79,22 +79,6 @@ if window.JHW
|
||||
|
||||
puts msg
|
||||
|
||||
JHW.createCoffeeScriptFileException = (e) ->
|
||||
if e and e.sourceURL
|
||||
filename = e.sourceURL.split('/').pop()
|
||||
|
||||
e =
|
||||
name: e.name
|
||||
message: e.message
|
||||
sourceURL: e.sourceURL
|
||||
lineNumber: e.line
|
||||
|
||||
if window.CoffeeScriptToFilename and realFilename = window.CoffeeScriptToFilename[filename]
|
||||
e.sourceURL = realFilename
|
||||
e.lineNumber = "~" + String(e.line)
|
||||
|
||||
e
|
||||
|
||||
window.CoffeeScriptToFilename = {}
|
||||
window.CSTF = window.CoffeeScriptToFilename
|
||||
|
||||
|
3209
vendor/assets/javascripts/dust-full-for-compile.js
vendored
Normal file
3209
vendor/assets/javascripts/dust-full-for-compile.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,3 @@
|
||||
(function() {
|
||||
|
||||
window.HeadlessReporterResult = (function() {
|
||||
|
||||
@ -75,5 +74,3 @@
|
||||
return HeadlessReporterResult;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
||||
|
44
vendor/assets/javascripts/intense.js
vendored
Normal file
44
vendor/assets/javascripts/intense.js
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
(function() {
|
||||
var code, method, _ref;
|
||||
|
||||
window.Intense = {
|
||||
colors: {
|
||||
black: 0,
|
||||
red: 1,
|
||||
green: 2,
|
||||
yellow: 3,
|
||||
blue: 4,
|
||||
magenta: 5,
|
||||
cyan: 6,
|
||||
white: 7
|
||||
},
|
||||
methods: {
|
||||
foreground: function(color) {
|
||||
if (Intense.useColors) {
|
||||
return "\033[3" + Intense.colors[color] + "m" + this + "\033[0m";
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
},
|
||||
bright: function() {
|
||||
if (Intense.useColors) {
|
||||
return "\033[1m" + this + "\033[0m";
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
},
|
||||
useColors: true,
|
||||
moveBack: function(count) {
|
||||
if (count == null) count = 1;
|
||||
return "\033[" + count + "D";
|
||||
}
|
||||
};
|
||||
|
||||
_ref = Intense.methods;
|
||||
for (method in _ref) {
|
||||
code = _ref[method];
|
||||
String.prototype[method] = code;
|
||||
}
|
||||
|
||||
}).call(this);
|
129
vendor/assets/javascripts/jasmine-extensions.js
vendored
Normal file
129
vendor/assets/javascripts/jasmine-extensions.js
vendored
Normal file
@ -0,0 +1,129 @@
|
||||
(function() {
|
||||
var generator, getSplitName, method, pauseAndRun, _i, _len, _ref;
|
||||
var __slice = Array.prototype.slice;
|
||||
|
||||
if (!(typeof jasmine !== "undefined" && jasmine !== null)) {
|
||||
throw new Error("jasmine not laoded!");
|
||||
}
|
||||
|
||||
if (window.JHW) {
|
||||
getSplitName = function(parts) {
|
||||
parts.push(String(this.description).replace(/[\n\r]/g, ' '));
|
||||
return parts;
|
||||
};
|
||||
jasmine.Suite.prototype.getSuiteSplitName = function() {
|
||||
return this.getSplitName(this.parentSuite ? this.parentSuite.getSuiteSplitName() : []);
|
||||
};
|
||||
jasmine.Spec.prototype.getSpecSplitName = function() {
|
||||
return this.getSplitName(this.suite.getSuiteSplitName());
|
||||
};
|
||||
jasmine.Suite.prototype.getSplitName = getSplitName;
|
||||
jasmine.Spec.prototype.getSplitName = getSplitName;
|
||||
jasmine.Spec.prototype.getJHWSpecInformation = function() {
|
||||
var parts, specLineInfo;
|
||||
parts = this.getSpecSplitName();
|
||||
specLineInfo = HeadlessReporterResult.findSpecLine(parts);
|
||||
if (specLineInfo.file) {
|
||||
parts.push("" + specLineInfo.file + ":" + specLineInfo.lineNumber);
|
||||
} else {
|
||||
parts.push('');
|
||||
}
|
||||
return parts.join("||");
|
||||
};
|
||||
jasmine.Spec.prototype.finishCallback = function() {
|
||||
JHW.ping();
|
||||
return this.env.reporter.reportSpecResults(this);
|
||||
};
|
||||
jasmine.Spec.prototype.fail = function(e) {
|
||||
var expectationResult, filename, realFilename;
|
||||
if (e && e.sourceURL && window.CoffeeScriptToFilename) {
|
||||
filename = e.sourceURL.split('/').pop();
|
||||
if (realFilename = window.CoffeeScriptToFilename[filename]) {
|
||||
e = {
|
||||
name: e.name,
|
||||
message: e.message,
|
||||
lineNumber: "~" + String(e.line),
|
||||
sourceURL: realFilename
|
||||
};
|
||||
}
|
||||
}
|
||||
expectationResult = new jasmine.ExpectationResult({
|
||||
passed: false,
|
||||
message: e ? jasmine.util.formatException(e) : 'Exception',
|
||||
trace: {
|
||||
stack: e.stack
|
||||
}
|
||||
});
|
||||
return this.results_.addResult(expectationResult);
|
||||
};
|
||||
jasmine.NestedResults.isValidSpecLine = function(line) {
|
||||
return line.match(/^\s*expect/) !== null || line.match(/^\s*return\s*expect/) !== null;
|
||||
};
|
||||
jasmine.NestedResults.parseFunction = function(func) {
|
||||
var line, lineCount, lines, _i, _len, _ref;
|
||||
lines = [];
|
||||
lineCount = 0;
|
||||
_ref = func.split("\n");
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
line = _ref[_i];
|
||||
if (jasmine.NestedResults.isValidSpecLine(line)) {
|
||||
line = line.replace(/^\s*/, '').replace(/\s*$/, '').replace(/^return\s*/, '');
|
||||
lines.push([line, lineCount]);
|
||||
}
|
||||
lineCount += 1;
|
||||
}
|
||||
return lines;
|
||||
};
|
||||
jasmine.NestedResults.parseAndStore = function(func) {
|
||||
if (!jasmine.NestedResults.ParsedFunctions[func]) {
|
||||
jasmine.NestedResults.ParsedFunctions[func] = jasmine.NestedResults.parseFunction(func);
|
||||
}
|
||||
return jasmine.NestedResults.ParsedFunctions[func];
|
||||
};
|
||||
jasmine.NestedResults.ParsedFunctions = [];
|
||||
if (!jasmine.WaitsBlock.prototype._execute) {
|
||||
jasmine.WaitsBlock.prototype._execute = jasmine.WaitsBlock.prototype.execute;
|
||||
jasmine.WaitsForBlock.prototype._execute = jasmine.WaitsForBlock.prototype.execute;
|
||||
pauseAndRun = function(onComplete) {
|
||||
JHW.timerPause();
|
||||
jasmine.getEnv().reporter.reportSpecWaiting();
|
||||
return this._execute(function() {
|
||||
jasmine.getEnv().reporter.reportSpecRunning();
|
||||
JHW.timerDone();
|
||||
return onComplete();
|
||||
});
|
||||
};
|
||||
jasmine.WaitsBlock.prototype.execute = pauseAndRun;
|
||||
jasmine.WaitsForBlock.prototype.execute = pauseAndRun;
|
||||
jasmine.NestedResults.prototype.addResult_ = jasmine.NestedResults.prototype.addResult;
|
||||
jasmine.NestedResults.prototype.addResult = function(result) {
|
||||
result.expectations = [];
|
||||
result.expectations = jasmine.NestedResults.parseAndStore(arguments.callee.caller.caller.caller.toString());
|
||||
return this.addResult_(result);
|
||||
};
|
||||
_ref = ["reportSpecWaiting", "reportSpecRunning"];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
method = _ref[_i];
|
||||
generator = function(method) {
|
||||
return function() {
|
||||
var args, reporter, _j, _len2, _ref2, _results;
|
||||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
||||
_ref2 = this.subReporters_;
|
||||
_results = [];
|
||||
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
|
||||
reporter = _ref2[_j];
|
||||
if (reporter[method] != null) {
|
||||
_results.push(reporter[method].apply(reporter, args));
|
||||
} else {
|
||||
_results.push(void 0);
|
||||
}
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
};
|
||||
jasmine.MultiReporter.prototype[method] = generator(method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}).call(this);
|
26
vendor/assets/javascripts/jasmine.HeadlessReporter.Console.js
vendored
Normal file
26
vendor/assets/javascripts/jasmine.HeadlessReporter.Console.js
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
(function() {
|
||||
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
|
||||
|
||||
jasmine.HeadlessReporter.Console = (function() {
|
||||
|
||||
__extends(Console, jasmine.HeadlessReporter.ConsoleBase);
|
||||
|
||||
function Console() {
|
||||
this.displayFailure = __bind(this.displayFailure, this);
|
||||
this.displaySuccess = __bind(this.displaySuccess, this);
|
||||
Console.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
Console.prototype.displaySuccess = function(spec) {
|
||||
return this.print('.'.foreground('green'));
|
||||
};
|
||||
|
||||
Console.prototype.displayFailure = function(spec) {
|
||||
return this.print('F'.foreground('red'));
|
||||
};
|
||||
|
||||
return Console;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
118
vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.js
vendored
Normal file
118
vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.js
vendored
Normal file
@ -0,0 +1,118 @@
|
||||
(function() {
|
||||
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
|
||||
|
||||
jasmine.HeadlessReporter.ConsoleBase = (function() {
|
||||
|
||||
__extends(ConsoleBase, jasmine.HeadlessReporter);
|
||||
|
||||
function ConsoleBase(callback) {
|
||||
this.callback = callback != null ? callback : null;
|
||||
this._waitRunner = __bind(this._waitRunner, this);
|
||||
ConsoleBase.__super__.constructor.call(this, this.callback);
|
||||
this.position = 0;
|
||||
this.positions = "|/-\\";
|
||||
}
|
||||
|
||||
ConsoleBase.prototype.formatResultLine = function(runtime) {
|
||||
var line;
|
||||
line = [];
|
||||
line.push(this.length);
|
||||
line.push((this.length === 1 ? "test" : "tests") + ',');
|
||||
line.push(this.failedCount);
|
||||
line.push((this.failedCount === 1 ? "failure" : "failures") + ',');
|
||||
line.push(runtime);
|
||||
line.push((runtime === 1.0 ? "sec" : "secs") + '.');
|
||||
return line.join(' ');
|
||||
};
|
||||
|
||||
ConsoleBase.prototype.reportRunnerResults = function(runner) {
|
||||
var result, resultLine, _i, _len, _ref;
|
||||
ConsoleBase.__super__.reportRunnerResults.call(this);
|
||||
this.print("\n");
|
||||
resultLine = this.formatResultLine(this._runtime());
|
||||
if (this.failedCount === 0) {
|
||||
this.puts(("PASS: " + resultLine).foreground('green'));
|
||||
} else {
|
||||
this.puts(("FAIL: " + resultLine).foreground('red'));
|
||||
}
|
||||
_ref = this.results;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
result = _ref[_i];
|
||||
this.puts(result.toString());
|
||||
}
|
||||
return this.puts("\nTest ordering seed: --seed " + (JHW.getSeed()));
|
||||
};
|
||||
|
||||
ConsoleBase.prototype.reportRunnerStarting = function(runner) {
|
||||
ConsoleBase.__super__.reportRunnerStarting.call(this, runner);
|
||||
if (!this.hasError()) {
|
||||
return this.puts("\nRunning Jasmine specs...".bright());
|
||||
}
|
||||
};
|
||||
|
||||
ConsoleBase.prototype.reportSpecWaiting = function() {
|
||||
if (!this.timer) {
|
||||
this.timer = true;
|
||||
this.first = true;
|
||||
return this._waitRunner();
|
||||
}
|
||||
};
|
||||
|
||||
ConsoleBase.prototype.reportSpecRunning = function() {
|
||||
if (this.timer) {
|
||||
clearTimeout(this.timer);
|
||||
this.timer = null;
|
||||
return this.print(Intense.moveBack());
|
||||
}
|
||||
};
|
||||
|
||||
ConsoleBase.prototype.reportSpecResults = function(spec) {
|
||||
var _this = this;
|
||||
ConsoleBase.__super__.reportSpecResults.call(this, spec);
|
||||
return this._reportSpecResult(spec, {
|
||||
success: function(results) {
|
||||
return _this.displaySuccess(spec);
|
||||
},
|
||||
failure: function(results) {
|
||||
_this.displayFailure(spec);
|
||||
return _this.reportFailureResult(results, new HeadlessReporterResult(spec.getFullName(), spec.getSpecSplitName()));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
ConsoleBase.prototype.reportFailureResult = function(results, failureResult) {
|
||||
var foundLine, result, testCount, _i, _len, _ref;
|
||||
testCount = 1;
|
||||
_ref = results.getItems();
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
result = _ref[_i];
|
||||
if (result.type === 'expect' && !result.passed_) {
|
||||
if (foundLine = result.expectations[testCount - 1]) {
|
||||
result.line = foundLine[0], result.lineNumber = foundLine[1];
|
||||
}
|
||||
failureResult.addResult(result);
|
||||
}
|
||||
testCount += 1;
|
||||
}
|
||||
return this.results.push(failureResult);
|
||||
};
|
||||
|
||||
ConsoleBase.prototype._waitRunner = function() {
|
||||
var _this = this;
|
||||
return this.timer = setTimeout(function() {
|
||||
if (_this.timer) {
|
||||
if (!_this.first) _this.print(Intense.moveBack());
|
||||
_this.print(_this.positions.substr(_this.position, 1).foreground('yellow'));
|
||||
_this.position += 1;
|
||||
_this.position %= _this.positions.length;
|
||||
_this.first = false;
|
||||
return _this._waitRunner();
|
||||
}
|
||||
}, 750);
|
||||
};
|
||||
|
||||
return ConsoleBase;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
41
vendor/assets/javascripts/jasmine.HeadlessReporter.File.js
vendored
Normal file
41
vendor/assets/javascripts/jasmine.HeadlessReporter.File.js
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
(function() {
|
||||
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
|
||||
|
||||
jasmine.HeadlessReporter.File = (function() {
|
||||
|
||||
__extends(File, jasmine.HeadlessReporter);
|
||||
|
||||
function File() {
|
||||
File.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
File.prototype.reportRunnerResults = function(runner) {
|
||||
var output;
|
||||
File.__super__.reportRunnerResults.call(this, runner);
|
||||
output = "TOTAL||" + this.length + "||" + this.failedCount + "||" + (this._runtime()) + "||" + (JHW._hasErrors ? "T" : "F");
|
||||
this.puts(output);
|
||||
return this.puts("SEED||" + (JHW.getSeed()));
|
||||
};
|
||||
|
||||
File.prototype.consoleLogUsed = function(msg) {
|
||||
return this.puts("CONSOLE||" + msg);
|
||||
};
|
||||
|
||||
File.prototype.reportSpecResults = function(spec) {
|
||||
var _this = this;
|
||||
File.__super__.reportSpecResults.call(this, spec);
|
||||
return this._reportSpecResult(spec, {
|
||||
success: function(results) {
|
||||
return _this.puts("PASS||" + spec.getJHWSpecInformation());
|
||||
},
|
||||
failure: function(results) {
|
||||
return _this.puts("FAIL||" + spec.getJHWSpecInformation());
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return File;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
40
vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.js
vendored
Normal file
40
vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.js
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
(function() {
|
||||
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
|
||||
|
||||
jasmine.HeadlessReporter.Tap = (function() {
|
||||
|
||||
__extends(Tap, jasmine.HeadlessReporter);
|
||||
|
||||
function Tap(outputTarget) {
|
||||
this.outputTarget = outputTarget != null ? outputTarget : null;
|
||||
Tap.__super__.constructor.call(this, this.outputTarget);
|
||||
this.output = [];
|
||||
}
|
||||
|
||||
Tap.prototype.reportRunnerResults = function(runner) {
|
||||
Tap.__super__.reportRunnerResults.call(this, runner);
|
||||
if (this.output.length > 0) this.output.unshift("1.." + this.output.length);
|
||||
return this.puts(this.output.join("\n"));
|
||||
};
|
||||
|
||||
Tap.prototype.reportSpecResults = function(spec) {
|
||||
var description, index;
|
||||
var _this = this;
|
||||
Tap.__super__.reportSpecResults.call(this, spec);
|
||||
index = this.output.length + 1;
|
||||
description = spec.getSpecSplitName().join(' ');
|
||||
return this._reportSpecResult(spec, {
|
||||
success: function(results) {
|
||||
return _this.output.push("ok " + index + " " + description);
|
||||
},
|
||||
failure: function(results) {
|
||||
return _this.output.push("not ok " + index + " " + description);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return Tap;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
@ -1,64 +0,0 @@
|
||||
#= require jasmine.HeadlessReporter.ConsoleBase
|
||||
#
|
||||
class jasmine.HeadlessReporter.Verbose extends jasmine.HeadlessReporter.ConsoleBase
|
||||
@prereport = false
|
||||
|
||||
displaySuccess: (spec) =>
|
||||
this.displaySpec(spec, 'green')
|
||||
|
||||
displayFailure: (spec) =>
|
||||
this.displaySpec(spec, 'red')
|
||||
|
||||
displaySpec: (spec, color) =>
|
||||
currentLastNames = (@lastNames || []).slice(0)
|
||||
@lastNames = spec.getSpecSplitName()
|
||||
|
||||
for line in this.indentSpec(@lastNames, currentLastNames, color)
|
||||
if line? and !_.isEmpty(line)
|
||||
this.puts(line)
|
||||
|
||||
indentSpec: (current, last, color) =>
|
||||
last = last.slice(0)
|
||||
|
||||
lines = []
|
||||
|
||||
for name in current
|
||||
if last.shift() != name
|
||||
lines.push(name)
|
||||
else
|
||||
lines.push(null)
|
||||
|
||||
this.indentLines(lines, color)
|
||||
|
||||
indentLines: (lines, color) =>
|
||||
indent = ''
|
||||
|
||||
output = []
|
||||
|
||||
for line in lines
|
||||
if line?
|
||||
outputLine = indent
|
||||
outputLine += this.colorLine(line, color)
|
||||
|
||||
output.push(outputLine)
|
||||
indent += ' '
|
||||
|
||||
output
|
||||
|
||||
colorLine: (line, color) =>
|
||||
line.foreground(color)
|
||||
|
||||
reportSpecStarting: (spec) =>
|
||||
if jasmine.HeadlessReporter.Verbose.prereport
|
||||
this.puts(spec.getSpecSplitName().join(' '))
|
||||
|
||||
reportException: (e) =>
|
||||
e = JHW.createCoffeeScriptFileException(e)
|
||||
|
||||
if e.sourceURL && e.lineNumber
|
||||
output = "#{e.sourceURL}:#{e.lineNumber} #{e.message}"
|
||||
else
|
||||
output = e.message ? e
|
||||
|
||||
this.puts(output.foreground('yellow'))
|
||||
|
48
vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.js
vendored
Normal file
48
vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.js
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
(function() {
|
||||
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
|
||||
|
||||
jasmine.HeadlessReporter.Verbose = (function() {
|
||||
|
||||
__extends(Verbose, jasmine.HeadlessReporter.ConsoleBase);
|
||||
|
||||
function Verbose() {
|
||||
this.indentSpec = __bind(this.indentSpec, this);
|
||||
this.displaySpec = __bind(this.displaySpec, this);
|
||||
this.displayFailure = __bind(this.displayFailure, this);
|
||||
this.displaySuccess = __bind(this.displaySuccess, this);
|
||||
Verbose.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
Verbose.prototype.displaySuccess = function(spec) {
|
||||
return this.displaySpec(spec, 'green');
|
||||
};
|
||||
|
||||
Verbose.prototype.displayFailure = function(spec) {
|
||||
return this.displaySpec(spec, 'red');
|
||||
};
|
||||
|
||||
Verbose.prototype.displaySpec = function(spec, color) {
|
||||
var currentLastNames;
|
||||
currentLastNames = (this.lastNames || []).slice(0);
|
||||
this.lastNames = spec.getSpecSplitName();
|
||||
return this.puts(this.indentSpec(this.lastNames, currentLastNames, color).join("\n"));
|
||||
};
|
||||
|
||||
Verbose.prototype.indentSpec = function(current, last, color) {
|
||||
var indent, name, output, _i, _len;
|
||||
last = last.slice(0);
|
||||
output = [];
|
||||
indent = '';
|
||||
for (_i = 0, _len = current.length; _i < _len; _i++) {
|
||||
name = current[_i];
|
||||
if (last.shift() !== name) output.push(indent + name.foreground(color));
|
||||
indent += ' ';
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
return Verbose;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
77
vendor/assets/javascripts/jasmine.HeadlessReporter.js
vendored
Normal file
77
vendor/assets/javascripts/jasmine.HeadlessReporter.js
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
(function() {
|
||||
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
||||
|
||||
if (!(typeof jasmine !== "undefined" && jasmine !== null)) {
|
||||
throw new Error("jasmine not loaded!");
|
||||
}
|
||||
|
||||
jasmine.HeadlessReporter = (function() {
|
||||
|
||||
function HeadlessReporter(outputTarget) {
|
||||
this.outputTarget = outputTarget != null ? outputTarget : null;
|
||||
this.puts = __bind(this.puts, this);
|
||||
this.print = __bind(this.print, this);
|
||||
this.results = [];
|
||||
this.failedCount = 0;
|
||||
this.length = 0;
|
||||
this.timer = null;
|
||||
}
|
||||
|
||||
HeadlessReporter.prototype.hasError = function() {
|
||||
return JHW._hasErrors;
|
||||
};
|
||||
|
||||
HeadlessReporter.prototype.reportSpecStarting = function(spec) {
|
||||
if (this.hasError()) {
|
||||
spec.finish();
|
||||
return spec.suite.finish();
|
||||
}
|
||||
};
|
||||
|
||||
HeadlessReporter.prototype.reportSuiteResults = function(suite) {};
|
||||
|
||||
HeadlessReporter.prototype.reportRunnerStarting = function(runner) {
|
||||
return this.startTime = new Date();
|
||||
};
|
||||
|
||||
HeadlessReporter.prototype.reportRunnerResults = function(runner) {
|
||||
if (this.hasError()) return;
|
||||
if (this.failedCount !== 0) JHW.hasSpecFailure();
|
||||
JHW.finishSuite();
|
||||
if (window.JHW) return window.onbeforeunload = null;
|
||||
};
|
||||
|
||||
HeadlessReporter.prototype.reportSpecResults = function(spec) {
|
||||
if (this.hasError()) return;
|
||||
return JHW.ping();
|
||||
};
|
||||
|
||||
HeadlessReporter.prototype._reportSpecResult = function(spec, options) {
|
||||
var results;
|
||||
results = spec.results();
|
||||
this.length++;
|
||||
if (results.passed()) {
|
||||
return options.success(results, spec);
|
||||
} else {
|
||||
this.failedCount++;
|
||||
return options.failure(results, spec);
|
||||
}
|
||||
};
|
||||
|
||||
HeadlessReporter.prototype._runtime = function() {
|
||||
return (new Date() - this.startTime) / 1000.0;
|
||||
};
|
||||
|
||||
HeadlessReporter.prototype.print = function(output) {
|
||||
return JHW.print(this.outputTarget, output);
|
||||
};
|
||||
|
||||
HeadlessReporter.prototype.puts = function(output) {
|
||||
return JHW.print(this.outputTarget, output + "\n");
|
||||
};
|
||||
|
||||
return HeadlessReporter;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
17
vendor/assets/javascripts/prolog.js
vendored
17
vendor/assets/javascripts/prolog.js
vendored
@ -82,23 +82,6 @@
|
||||
JHW._usedConsole = true;
|
||||
return puts(msg);
|
||||
};
|
||||
JHW.createCoffeeScriptFileException = function(e) {
|
||||
var filename, realFilename;
|
||||
if (e && e.sourceURL) {
|
||||
filename = e.sourceURL.split('/').pop();
|
||||
e = {
|
||||
name: e.name,
|
||||
message: e.message,
|
||||
sourceURL: e.sourceURL,
|
||||
lineNumber: e.line
|
||||
};
|
||||
if (window.CoffeeScriptToFilename && (realFilename = window.CoffeeScriptToFilename[filename])) {
|
||||
e.sourceURL = realFilename;
|
||||
e.lineNumber = "~" + String(e.line);
|
||||
}
|
||||
}
|
||||
return e;
|
||||
};
|
||||
}
|
||||
|
||||
window.CoffeeScriptToFilename = {};
|
||||
|
Loading…
Reference in New Issue
Block a user