opal-minitest 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e83a2f32f86c95bffe2f7e767d24029bb6e964a
4
- data.tar.gz: 055bd3b1cdf46f2e925bdceb9b0a17d8be316214
3
+ metadata.gz: beef9c7e7889e199cee93efe1c4830ce67d8eb95
4
+ data.tar.gz: c5f7bf324fa9081575845ecb604ea12d81f30b33
5
5
  SHA512:
6
- metadata.gz: 91aa4d9bcbf298deefc3b1f6abfcf46be62261a016eb98d8bf06020256262dab1ca91f178435ddfe5463f8288a6cd62c11b26be4e958b63fb1f329fe5c4e7e0a
7
- data.tar.gz: deea64d6f44b217240cfc07104f829bec5bc9958d96814f6f5d47062cd0d8865e6cf4fc28dd93ce47dcb51085db83b3867589580ea80decbff5ece2f95a37c24
6
+ metadata.gz: 695b862c482ed1ce1f63af2f8b5a86640a793fb1c96c32dbbbf5e58c260fd2840c2c221c7a24dea113ca1c13499b4e7e606b421e6549198098b420127bf86a9b
7
+ data.tar.gz: 0d3b6e926cdc96cabc184d9c566bc3f902e453bf15df70f6f88f3855d98e6fc82d83c57f2365eb596880456f8005dc2035bf58ae1ca89ff2978d748bb8709bfa
data/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ 0.0.4 (2014-09-10)
2
+ ------------------
3
+ * RakeTask initializer takes arguments hash
4
+ * RakeTask `port` and `requires_glob` options
5
+
6
+ 0.0.3 (2014-06-22)
7
+ ------------------
8
+ * First functional version!
data/README.md CHANGED
@@ -1,34 +1,32 @@
1
1
  # opal-minitest
2
2
 
3
- Opal port/utilities for MiniTest
4
-
5
- ## Status
6
-
7
- Currently supports:
8
-
9
- * Core classes
10
- * Test (except parallel running, plugins and CLI options)
11
- * Assertions (except `#capture_subprocess_io`)
12
-
13
- Any differences from vanilla Minitest are documented with an `OMT` label.
3
+ Minitest, now for Opal!
14
4
 
15
5
  ## Usage
16
6
 
17
- Add the gem to a project's Gemfile.
7
+ First, add the `opal-minitest` gem to a project's Gemfile.
18
8
 
19
9
  ```ruby
20
10
  # Gemfile
21
11
  gem 'opal-minitest'
22
12
  ```
23
13
 
24
- Use the Rake task to headlessly run the project's tests.
14
+ `$ bundle install`
15
+
16
+ Finally, use the included Rake task to headlessly run the project's tests.
25
17
 
26
18
  ```ruby
27
19
  # Rakefile
28
20
  require 'opal/minitest/rake_task'
29
- Opal::Minitest::RakeTask.new(:default)
21
+ Opal::Minitest::RakeTask.new(name: :default)
30
22
  ```
31
23
 
32
24
  `$ bundle exec rake`
33
25
 
34
- This will require standard test_helper and test code files and then run all tests.
26
+ This will run all Ruby/Opal files ending in `_test` in the `test/` directory, after an optional `test_helper` file in the same directory. Try the example!
27
+
28
+ ## Status
29
+
30
+ Opal Minitest can currently do everything regular Minitest can, except parallel running, plugins, CLI options, and `#capture_subprocess_io`.
31
+
32
+ Any code differences in the port from regular Minitest are documented with an `OMT` label.
data/Rakefile CHANGED
@@ -1,2 +1,2 @@
1
1
  require 'opal/minitest/rake_task'
2
- Opal::Minitest::RakeTask.new(:default)
2
+ Opal::Minitest::RakeTask.new(name: :default)
data/example/Rakefile CHANGED
@@ -13,5 +13,6 @@ task('regtest') do
13
13
 
14
14
  %w[opal test].each { |p| $LOAD_PATH << p }
15
15
 
16
+ require_relative 'test/test_helper.rb'
16
17
  Dir['test/**/*_test.rb'].each { |f| require_relative f }
17
18
  end
@@ -6,35 +6,53 @@ module Opal
6
6
  class RakeTask
7
7
  include Rake::DSL
8
8
 
9
- PORT = 2838
10
- RUNNER = File.expand_path('../../../../vendor/runner.js', __FILE__)
9
+ RUNNER_PATH = File.expand_path('../../../../vendor/runner.js', __FILE__)
10
+
11
+ def initialize(args)
12
+ args = defaults.merge(args)
11
13
 
12
- def initialize(name = 'opal:minitest')
13
14
  desc "Run tests through opal-minitest"
14
- task(name) do
15
+ task(args[:name]) do
15
16
  require 'rack'
16
17
  require 'webrick'
17
18
 
18
19
  server = fork {
19
20
  Rack::Server.start(
20
- app: Server.new,
21
- Port: PORT,
21
+ app: Server.new(requires_glob: args[:requires_glob]),
22
+ Port: args[:port],
22
23
  server: 'webrick',
23
24
  Logger: WEBrick::Log.new('/dev/null'),
24
25
  AccessLog: [])
25
26
  }
26
27
 
27
- system "phantomjs #{RUNNER} \"http://localhost:#{PORT}\""
28
+ system "phantomjs #{RUNNER_PATH} \"http://localhost:#{args[:port]}\""
28
29
 
29
30
  Process.kill(:SIGINT, server)
30
31
  Process.wait
31
32
  end
32
33
  end
33
34
 
35
+ private
36
+
37
+ def defaults
38
+ {
39
+ name: 'opal:minitest',
40
+ port: 2838,
41
+ requires_glob: 'test/{test_helper,**/*_test}.{rb,opal}'
42
+ }
43
+ end
44
+
34
45
  class Server < Opal::Server
35
- def initialize
46
+ attr_reader :requires_glob
47
+
48
+ def initialize(args)
49
+ gem_path = Pathname.new(__FILE__).join('../../../..')
50
+ self.index_path = gem_path.join('opal/opal/minitest/runner.html.erb').to_s
51
+
36
52
  super
37
53
 
54
+ $omt_requires_glob = args.fetch(:requires_glob)
55
+
38
56
  $LOAD_PATH.each { |p| append_path(p) }
39
57
  append_path 'test'
40
58
  self.main = 'opal/minitest/loader'
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  module Minitest
3
- VERSION = '0.0.3'
3
+ VERSION = '0.0.4'
4
4
  end
5
5
  end
@@ -8,9 +8,9 @@ Gem::Specification.new do |s|
8
8
  s.name = 'opal-minitest'
9
9
  s.version = Opal::Minitest::VERSION
10
10
  s.author = 'Artur Ostrega'
11
- s.email = 'artur.mariusz.ostrega@gmail.com'
12
- s.summary = 'MiniTest for Opal'
13
- s.description = 'MiniTest test runner for Opal'
11
+ s.email = 'skoofoo@gmail.com'
12
+ s.summary = 'Minitest, now for Opal!'
13
+ s.description = 'Minitest test runner for Opal'
14
14
 
15
15
  s.files = `git ls-files`.split("\n")
16
16
 
@@ -18,6 +18,6 @@ Gem::Specification.new do |s|
18
18
 
19
19
  s.add_dependency 'opal', '>= 0.6'
20
20
  s.add_dependency 'rake', '~> 10.3'
21
- s.add_development_dependency 'minitest', '5.3.2'
21
+ s.add_development_dependency 'minitest', '5.3.4'
22
22
  end
23
23
 
data/opal/minitest.rb CHANGED
@@ -1,10 +1,10 @@
1
- # OMT: unsupported
1
+ # PORT: unsupported
2
2
  #require "optparse"
3
3
  #require "thread"
4
4
  #require "mutex_m"
5
5
  #require "minitest/parallel"
6
6
 
7
- # OMT: added
7
+ # PORT: added
8
8
  require "minitest/core_classes"
9
9
 
10
10
  ##
@@ -20,7 +20,7 @@ module Minitest
20
20
 
21
21
  ##
22
22
  # Parallel test executor
23
- # OMT: unsupported
23
+ # PORT: unsupported
24
24
 
25
25
  #mc.send :attr_accessor, :parallel_executor
26
26
  #self.parallel_executor = Parallel::Executor.new((ENV['N'] || 2).to_i)
@@ -39,13 +39,13 @@ module Minitest
39
39
 
40
40
  ##
41
41
  # Names of known extension plugins.
42
- # OMT: unsupported
42
+ # PORT: unsupported
43
43
 
44
44
  #mc.send :attr_accessor, :extensions
45
45
 
46
46
  ##
47
47
  # Registers Minitest to run at process exit
48
- # OMT: unsupported
48
+ # PORT: unsupported
49
49
 
50
50
  # def self.autorun
51
51
  # at_exit {
@@ -73,7 +73,7 @@ module Minitest
73
73
  @@after_run << block
74
74
  end
75
75
 
76
- # OMT: unsupported
76
+ # PORT: unsupported
77
77
  #def self.init_plugins options # :nodoc:
78
78
  # self.extensions.each do |name|
79
79
  # msg = "plugin_#{name}_init"
@@ -81,7 +81,7 @@ module Minitest
81
81
  # end
82
82
  #end
83
83
 
84
- # OMT: unsupported
84
+ # PORT: unsupported
85
85
  #def self.load_plugins # :nodoc:
86
86
  # return unless self.extensions.empty?
87
87
 
@@ -118,7 +118,7 @@ module Minitest
118
118
  # klass.new(runnable_method).run
119
119
 
120
120
  def self.run args = []
121
- # OMT: removed
121
+ # PORT: removed
122
122
  #self.load_plugins
123
123
 
124
124
  options = process_args args
@@ -128,17 +128,17 @@ module Minitest
128
128
  reporter << ProgressReporter.new(options[:io], options)
129
129
 
130
130
  self.reporter = reporter # this makes it available to plugins
131
- # OMT: removed
131
+ # PORT: removed
132
132
  #self.init_plugins options
133
133
  self.reporter = nil # runnables shouldn't depend on the reporter, ever
134
134
 
135
135
  reporter.start
136
136
  __run reporter, options
137
- # OMT: removed
137
+ # PORT: removed
138
138
  #self.parallel_executor.shutdown
139
139
  reporter.report
140
140
 
141
- # OMT: modified
141
+ # PORT: modified
142
142
  #reporter.passed?
143
143
  `window.OPAL_TEST_EXIT_STATUS = #{reporter.passed?}`
144
144
  end
@@ -169,7 +169,7 @@ module Minitest
169
169
  }
170
170
  orig_args = args.dup
171
171
 
172
- # OMT: unsupported
172
+ # PORT: unsupported
173
173
  # OptionParser.new do |opts|
174
174
  # opts.banner = "minitest options:"
175
175
  # opts.version = Minitest::VERSION
@@ -234,7 +234,7 @@ module Minitest
234
234
  end
235
235
 
236
236
  ##
237
- # OMT: section moved to core_classes.rb
237
+ # PORT: section moved to core_classes.rb
238
238
  ##
239
239
 
240
240
  self.backtrace_filter = BacktraceFilter.new
@@ -247,5 +247,5 @@ module Minitest
247
247
  end
248
248
 
249
249
  require "minitest/test"
250
- # OMT: unsupported
250
+ # PORT: unsupported
251
251
  #require "minitest/unit" unless defined?(MiniTest) # compatibility layer only
@@ -1,4 +1,4 @@
1
- # OMT: removed
1
+ # PORT: removed
2
2
  #require "rbconfig"
3
3
 
4
4
  module Minitest
@@ -24,7 +24,7 @@ module Minitest
24
24
  # figure out what diff to use.
25
25
 
26
26
  def self.diff
27
- # OMT: unsupported
27
+ # PORT: unsupported
28
28
  # @diff = if (RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ &&
29
29
  # system("diff.exe", __FILE__, __FILE__)) then
30
30
  # "diff.exe -u"
@@ -55,7 +55,7 @@ module Minitest
55
55
  # comparison between the two.
56
56
 
57
57
  def diff exp, act
58
- # OMT: changed
58
+ # PORT: changed
59
59
  # require "tempfile"
60
60
  #
61
61
  # expect = mu_pp_for_diff exp
@@ -434,7 +434,7 @@ module Minitest
434
434
  #
435
435
  # NOTE: This method is approximately 10x slower than #capture_io so
436
436
  # only use it when you need to test the output of a subprocess.
437
- # OMT: unsupported
437
+ # PORT: unsupported
438
438
 
439
439
  # def capture_subprocess_io
440
440
  # _synchronize do
@@ -87,7 +87,7 @@ module Minitest
87
87
  end
88
88
 
89
89
  def self.on_signal name, action # :nodoc:
90
- # OMT: modified
90
+ # PORT: modified
91
91
  #supported = Signal.list[name]
92
92
 
93
93
  #old_trap = trap name do
@@ -173,7 +173,7 @@ module Minitest
173
173
  # you want. Go nuts.
174
174
 
175
175
  class AbstractReporter
176
- # OMT: unsupported
176
+ # PORT: unsupported
177
177
  #include Mutex_m
178
178
 
179
179
  ##
@@ -327,7 +327,7 @@ module Minitest
327
327
  def report # :nodoc:
328
328
  super
329
329
 
330
- # OMT: unsupported
330
+ # PORT: unsupported
331
331
  #io.sync = self.old_sync
332
332
 
333
333
  io.puts unless options[:verbose] # finish the dots
@@ -407,7 +407,7 @@ module Minitest
407
407
  ##
408
408
  # Represents run failures.
409
409
 
410
- # OMT: modified
410
+ # PORT: modified
411
411
  #class Assertion < Exception
412
412
  class Assertion
413
413
  def error # :nodoc:
@@ -434,25 +434,25 @@ module Minitest
434
434
  "Failure"
435
435
  end
436
436
 
437
- # OMT: added
437
+ # PORT: added
438
438
  def initialize(message = '')
439
439
  @message = message
440
440
  end
441
441
 
442
- # OMT: added
442
+ # PORT: added
443
443
  attr_reader :message
444
444
 
445
- # OMT: added
445
+ # PORT: added
446
446
  def backtrace
447
447
  []
448
448
  end
449
449
 
450
- # OMT: added
450
+ # PORT: added
451
451
  def inspect
452
452
  "#<#{self.class.name}: '#@message'>"
453
453
  end
454
454
 
455
- # OMT: added
455
+ # PORT: added
456
456
  alias to_s message
457
457
  end
458
458
 
@@ -513,7 +513,7 @@ module Minitest
513
513
 
514
514
  ##
515
515
  # Is this running on opal?
516
- # OMT: added
516
+ # PORT: added
517
517
 
518
518
  def opal? platform = RUBY_PLATFORM
519
519
  "opal" == platform
@@ -1,4 +1,4 @@
1
- # OMT: removed
1
+ # PORT: removed
2
2
  #require "minitest" unless defined? Minitest::Runnable
3
3
 
4
4
  module Minitest
@@ -12,12 +12,12 @@ module Minitest
12
12
  require "minitest/assertions"
13
13
  include Minitest::Assertions
14
14
 
15
- # OMT: modified
15
+ # PORT: modified
16
16
  #PASSTHROUGH_EXCEPTIONS = [NoMemoryError, SignalException, # :nodoc:
17
17
  # Interrupt, SystemExit]
18
18
  PASSTHROUGH_EXCEPTIONS = [SystemExit] # :nodoc:
19
19
 
20
- # OMT: unsupported
20
+ # PORT: unsupported
21
21
  #class << self; attr_accessor :io_lock; end
22
22
  #self.io_lock = Mutex.new
23
23
 
@@ -51,7 +51,7 @@ module Minitest
51
51
  # Call this at the top of your tests when you want to run your
52
52
  # tests in parallel. In doing so, you're admitting that you rule
53
53
  # and your tests are awesome.
54
- # OMT: unsupported
54
+ # PORT: unsupported
55
55
 
56
56
  #def self.parallelize_me!
57
57
  # include Minitest::Parallel::Test
@@ -65,7 +65,7 @@ module Minitest
65
65
 
66
66
  def self.runnable_methods
67
67
  methods = methods_matching(/^test_/)
68
- # OMT: added
68
+ # PORT: added
69
69
  methods.delete('test_order')
70
70
 
71
71
  case self.test_order
@@ -1,7 +1,7 @@
1
1
  <% require_asset 'opal' %>
2
2
  <% require_asset 'minitest' %>
3
3
 
4
- <% Dir['test/{test_helper,**/*_test}.{rb,opal}'].each { |file|
4
+ <% Dir[$omt_requires_glob].each { |file|
5
5
  require_asset file.sub(/^test\//, '').sub(/\.{rb,opal}$/, '')
6
6
  } %>
7
7
 
@@ -0,0 +1,9 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Opal Minitest</title>
5
+ </head>
6
+ <body>
7
+ <%= javascript_include_tag @server.main %>
8
+ </body>
9
+ </html>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-minitest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artur Ostrega
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-23 00:00:00.000000000 Z
11
+ date: 2014-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal
@@ -44,21 +44,22 @@ dependencies:
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 5.3.2
47
+ version: 5.3.4
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 5.3.2
55
- description: MiniTest test runner for Opal
56
- email: artur.mariusz.ostrega@gmail.com
54
+ version: 5.3.4
55
+ description: Minitest test runner for Opal
56
+ email: skoofoo@gmail.com
57
57
  executables: []
58
58
  extensions: []
59
59
  extra_rdoc_files: []
60
60
  files:
61
61
  - .gitignore
62
+ - CHANGELOG.md
62
63
  - Gemfile
63
64
  - README.md
64
65
  - Rakefile
@@ -76,6 +77,7 @@ files:
76
77
  - opal/minitest/core_classes.rb
77
78
  - opal/minitest/test.rb
78
79
  - opal/opal/minitest/loader.rb.erb
80
+ - opal/opal/minitest/runner.html.erb
79
81
  - test/example_test.rb
80
82
  - vendor/runner.js
81
83
  homepage:
@@ -100,6 +102,6 @@ rubyforge_project:
100
102
  rubygems_version: 2.2.2
101
103
  signing_key:
102
104
  specification_version: 4
103
- summary: MiniTest for Opal
105
+ summary: Minitest, now for Opal!
104
106
  test_files: []
105
107
  has_rdoc: