opal-minitest 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/Gemfile +3 -0
- data/README.md +31 -0
- data/Rakefile +2 -0
- data/example/Gemfile +4 -0
- data/example/Rakefile +17 -0
- data/example/opal/bacterium.rb +5 -0
- data/example/test/bacterium_test.rb +11 -0
- data/lib/opal/minitest/rake_task.rb +45 -0
- data/lib/opal/minitest/version.rb +5 -0
- data/lib/opal/minitest.rb +4 -0
- data/opal/minitest/assertions.rb +666 -0
- data/opal/minitest/core_classes.rb +571 -0
- data/opal/minitest/test.rb +290 -0
- data/opal/minitest.rb +251 -0
- data/opal/opal/minitest/loader.rb.erb +8 -0
- data/opal-minitest.gemspec +23 -0
- data/test/example_test.rb +23 -0
- data/vendor/runner.js +23 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8a5d0324af8d3dac6776e3a727a02cfce6cc46e3
|
4
|
+
data.tar.gz: 7112796e1cc168e535849d757fcb5024046c290d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4d070c4dcb8bd517c0d662d9b3eae74cdaaf5d87525230ba7a16d36e080abf03cf466f9fcb17e5194a66e84797d11e0b1965ed6c848f19865d8e1a92e5db7d00
|
7
|
+
data.tar.gz: 8226d9ec681b510173d8ae24227fbef33c3b36a015535954af2ee504169c28211e3eafca210fb19e4916eef6db58d14206623eeab5c4e8b58f0bbec6d42ebf53
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# opal-minitest
|
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.
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
Add the gem to a project's Gemfile.
|
18
|
+
|
19
|
+
`gem 'opal-minitest'`
|
20
|
+
|
21
|
+
Use the Rake task to headlessly runs a project's tests.
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
# Rakefile
|
25
|
+
require 'opal/minitest/rake_task'
|
26
|
+
Opal::Minitest::RakeTask.new(:default)
|
27
|
+
```
|
28
|
+
|
29
|
+
`$ bundle exec rake`
|
30
|
+
|
31
|
+
This will require standard test_helper and test files and then run all tests.
|
data/Rakefile
ADDED
data/example/Gemfile
ADDED
data/example/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'opal/minitest/rake_task'
|
2
|
+
|
3
|
+
# Register code in /opal with Opal.
|
4
|
+
Opal.append_path File.expand_path('../opal', __FILE__)
|
5
|
+
|
6
|
+
Opal::MiniTest::RakeTask.new(:default)
|
7
|
+
|
8
|
+
|
9
|
+
desc "Run tests through regular Minitest"
|
10
|
+
task('regtest') do
|
11
|
+
require 'minitest'
|
12
|
+
require 'minitest/autorun'
|
13
|
+
|
14
|
+
%w[opal test].each { |p| $LOAD_PATH << p }
|
15
|
+
|
16
|
+
Dir['test/**/*_test.rb'].each { |f| require_relative f }
|
17
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'opal/minitest'
|
2
|
+
|
3
|
+
module Opal
|
4
|
+
module MiniTest
|
5
|
+
class RakeTask
|
6
|
+
include Rake::DSL
|
7
|
+
|
8
|
+
PORT = 2838
|
9
|
+
RUNNER = File.expand_path('../../../../vendor/runner.js', __FILE__)
|
10
|
+
|
11
|
+
def initialize(name = 'opal:minitest')
|
12
|
+
desc "Run tests through opal-minitest"
|
13
|
+
task(name) do
|
14
|
+
require 'rack'
|
15
|
+
require 'webrick'
|
16
|
+
|
17
|
+
server = fork {
|
18
|
+
Rack::Server.start(
|
19
|
+
app: Server.new,
|
20
|
+
Port: PORT,
|
21
|
+
server: 'webrick',
|
22
|
+
Logger: WEBrick::Log.new('/dev/null'),
|
23
|
+
AccessLog: [])
|
24
|
+
}
|
25
|
+
|
26
|
+
system "phantomjs #{RUNNER} \"http://localhost:#{PORT}\""
|
27
|
+
|
28
|
+
Process.kill(:SIGINT, server)
|
29
|
+
Process.wait
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class Server < Opal::Server
|
34
|
+
def initialize
|
35
|
+
super
|
36
|
+
|
37
|
+
$LOAD_PATH.each { |p| append_path(p) }
|
38
|
+
append_path 'test'
|
39
|
+
self.main = 'opal/minitest/loader'
|
40
|
+
self.debug = false
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|