Class: NodeJSFormatter

Inherits:
BrowserFormatter show all
Defined in:
opal/lib/mspec/opal/runner.rb

Direct Known Subclasses

NodeJSDocFormatter

Instance Method Summary collapse

Methods inherited from BrowserFormatter

#before, #enter, #exception, #exception?, #failure?, #finish, #initialize, #register, #start

Constructor Details

This class inherits a constructor from BrowserFormatter

Instance Method Details

#after(state) ⇒ Object



161
162
163
164
# File 'opal/lib/mspec/opal/runner.rb', line 161

def after(state)
  super
  print_example(state)
end

#finish_with_code(code) ⇒ Object



174
175
176
# File 'opal/lib/mspec/opal/runner.rb', line 174

def finish_with_code(code)
  `global.OPAL_SPEC_CODE = code;`
end

#green(str) ⇒ Object



149
150
151
# File 'opal/lib/mspec/opal/runner.rb', line 149

def green(str)
  `process.stdout.write("\033[32m"+#{str}+"\033[0m")`
end

#log(str) ⇒ Object



157
158
159
# File 'opal/lib/mspec/opal/runner.rb', line 157

def log(str)
  puts str
end


166
167
168
169
170
171
172
# File 'opal/lib/mspec/opal/runner.rb', line 166

def print_example(state)
  unless exception?
    green('.')
  else
    red(failure? ? 'F' : 'E')
  end
end

#red(str) ⇒ Object



153
154
155
# File 'opal/lib/mspec/opal/runner.rb', line 153

def red(str)
  `process.stdout.write("\033[31m"+#{str}+"\033[0m")`
end