Class: Opal::Minitest::RakeTask
- Inherits:
-
Object
- Object
- Opal::Minitest::RakeTask
- Includes:
- Rake::DSL
- Defined in:
- lib/opal/minitest/rake_task.rb
Defined Under Namespace
Classes: Server
Constant Summary collapse
- RUNNER_PATH =
File.('../../../../vendor/runner.js', __FILE__)
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ RakeTask
constructor
A new instance of RakeTask.
Constructor Details
#initialize(args = {}) ⇒ RakeTask
Returns a new instance of RakeTask.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/opal/minitest/rake_task.rb', line 11 def initialize(args = {}) args = defaults.merge(args) desc "Run tests through opal-minitest" task(args[:name]) do require 'rack' require 'webrick' require 'tilt/erb' server = fork { Rack::Server.start( app: Server.new(requires_glob: args[:requires_glob]), Port: args[:port], server: 'webrick', Logger: WEBrick::Log.new('/dev/null'), AccessLog: []) } system "phantomjs \"#{RUNNER_PATH}\" \"http://localhost:#{args[:port]}\"" Process.kill(:SIGINT, server) Process.wait end end |