-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some colors to text formatter output
- Loading branch information
1 parent
db6d77f
commit 010c01c
Showing
6 changed files
with
70 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
require 'opal/rspec' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,52 @@ | ||
module Opal; module RSpec | ||
class Runner | ||
module Opal | ||
module RSpec | ||
class Runner | ||
|
||
class << self | ||
def browser? | ||
`typeof(document) !== "undefined"` | ||
end | ||
class << self | ||
def browser? | ||
`typeof(document) !== "undefined"` | ||
end | ||
|
||
def phantom? | ||
`typeof(phantom) !== 'undefined' || typeof(OPAL_SPEC_PHANTOM) !== 'undefined'` | ||
end | ||
def phantom? | ||
`typeof(phantom) !== 'undefined' || typeof(OPAL_SPEC_PHANTOM) !== 'undefined'` | ||
end | ||
|
||
def default_formatter | ||
if phantom? | ||
TextFormatter | ||
else # browser | ||
BrowserFormatter | ||
def default_formatter | ||
if phantom? | ||
TextFormatter | ||
else # browser | ||
BrowserFormatter | ||
end | ||
end | ||
end | ||
|
||
def autorun | ||
if browser? | ||
`setTimeout(function() { #{Runner.new.run} }, 0)` | ||
else # phantom | ||
Runner.new.run | ||
def autorun | ||
if browser? | ||
`setTimeout(function() { #{Runner.new.run} }, 0)` | ||
else # phantom | ||
Runner.new.run | ||
end | ||
end | ||
end | ||
end | ||
|
||
def initialize(options={}, configuration=::RSpec::configuration, world=::RSpec::world) | ||
@options = options | ||
@configuration = configuration | ||
@world = world | ||
end | ||
def initialize(options={}, configuration=::RSpec::configuration, world=::RSpec::world) | ||
@options = options | ||
@configuration = configuration | ||
@world = world | ||
end | ||
|
||
def run(err=$stdout, out=$stdout) | ||
@configuration.error_stream = err | ||
@configuration.output_stream ||= out | ||
def run(err=$stdout, out=$stdout) | ||
@configuration.error_stream = err | ||
@configuration.output_stream ||= out | ||
|
||
@configuration.reporter.report(@world.example_count) do |reporter| | ||
begin | ||
@configuration.run_hook(:before, :suite) | ||
@world.example_groups.map {|g| g.run(reporter) }.all? ? 0 : @configuration.failure_exit_code | ||
ensure | ||
@configuration.run_hook(:after, :suite) | ||
@configuration.reporter.report(@world.example_count) do |reporter| | ||
begin | ||
@configuration.run_hook(:before, :suite) | ||
@world.example_groups.map {|g| g.run(reporter) }.all? ? 0 : @configuration.failure_exit_code | ||
ensure | ||
@configuration.run_hook(:after, :suite) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end; end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters