jstdutil 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/jsautotest +7 -1
- data/lib/jstdutil/autotest.rb +2 -0
- data/lib/jstdutil/jstestdriver/config.rb +6 -1
- data/lib/jstdutil/jstestdriver/server.rb +6 -2
- data/lib/jstdutil/redgreen.rb +3 -0
- data/lib/jstdutil/test_runner.rb +10 -4
- data/test/jstestdriver_config_test.rb +4 -4
- data/test/test_helper.rb +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/bin/jsautotest
CHANGED
data/lib/jstdutil/autotest.rb
CHANGED
@@ -24,12 +24,17 @@ module Jstdutil
|
|
24
24
|
super
|
25
25
|
end
|
26
26
|
|
27
|
+
def respond_to?(name)
|
28
|
+
return true if @contents.key?(name.to_s)
|
29
|
+
super
|
30
|
+
end
|
31
|
+
|
27
32
|
private
|
28
33
|
def load_config(contents)
|
29
34
|
@contents = YAML.load(contents)
|
30
35
|
|
31
36
|
if !@contents.respond_to?(:key?) || !@contents.key?("server")
|
32
|
-
raise ArgumentError.new("Error:
|
37
|
+
raise ArgumentError.new("Error: Unable to locate 'server' configuration setting. Did you provide a --config?")
|
33
38
|
end
|
34
39
|
|
35
40
|
@contents
|
@@ -4,11 +4,15 @@ require "uri"
|
|
4
4
|
module Jstdutil
|
5
5
|
module JsTestDriver
|
6
6
|
class Server
|
7
|
+
attr_reader :uri
|
8
|
+
|
7
9
|
def initialize(config, args = nil)
|
8
|
-
|
10
|
+
uri = config.respond_to?(:server) ? config.server : config
|
11
|
+
@uri = URI.parse(uri)
|
9
12
|
@args = args
|
10
|
-
# @server = nil
|
11
13
|
@pid = nil
|
14
|
+
rescue URI::InvalidURIError => err
|
15
|
+
raise StandardError.new("Invalid test driver server URL #{uri}")
|
12
16
|
end
|
13
17
|
|
14
18
|
def running?
|
data/lib/jstdutil/redgreen.rb
CHANGED
@@ -2,6 +2,9 @@ begin
|
|
2
2
|
require 'Win32/Console/ANSI' if PLATFORM =~ /win32/
|
3
3
|
rescue LoadError
|
4
4
|
raise 'You must gem install win32console to use color on Windows'
|
5
|
+
rescue NameError
|
6
|
+
# PLATFORM is not defined, not a problem on windows.
|
7
|
+
# On other platforms we don't care
|
5
8
|
end
|
6
9
|
|
7
10
|
module Jstdutil
|
data/lib/jstdutil/test_runner.rb
CHANGED
@@ -15,6 +15,8 @@ module Jstdutil
|
|
15
15
|
if config && config.server
|
16
16
|
@server = JsTestDriver::Server.new(config, args({}, ["port"]).join(" "))
|
17
17
|
end
|
18
|
+
rescue StandardError => err
|
19
|
+
raise err
|
18
20
|
end
|
19
21
|
|
20
22
|
def test_cases(files)
|
@@ -25,10 +27,14 @@ module Jstdutil
|
|
25
27
|
end
|
26
28
|
|
27
29
|
def run(tests = "all")
|
28
|
-
begin
|
29
|
-
|
30
|
-
rescue StandardError => err
|
31
|
-
|
30
|
+
#begin
|
31
|
+
# @server.start unless @server.running?
|
32
|
+
#rescue StandardError => err
|
33
|
+
# puts err.message
|
34
|
+
#end
|
35
|
+
if !@server.running?
|
36
|
+
puts "Server not running, you want to start it with jstestdriver --port #{@server.uri.port}"
|
37
|
+
exit
|
32
38
|
end
|
33
39
|
|
34
40
|
puts(Time.now.strftime("%F %H:%M:%S Running #{tests}"))
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require "test_helper"
|
2
|
-
require "jstdutil/
|
2
|
+
require "jstdutil/jstestdriver/config"
|
3
3
|
|
4
4
|
class JsTestDriverConfigTest < Test::Unit::TestCase
|
5
5
|
context "creating JsTestDriverConfig instances" do
|
@@ -17,7 +17,7 @@ class JsTestDriverConfigTest < Test::Unit::TestCase
|
|
17
17
|
config = nil
|
18
18
|
|
19
19
|
assert_nothing_raised do
|
20
|
-
config = Jstdutil::
|
20
|
+
config = Jstdutil::JsTestDriver::Config.new @file
|
21
21
|
end
|
22
22
|
|
23
23
|
assert_equal @server, config.server
|
@@ -27,7 +27,7 @@ class JsTestDriverConfigTest < Test::Unit::TestCase
|
|
27
27
|
config = nil
|
28
28
|
|
29
29
|
assert_nothing_raised do
|
30
|
-
config = Jstdutil::
|
30
|
+
config = Jstdutil::JsTestDriver::Config.new "server: #{@server}"
|
31
31
|
end
|
32
32
|
|
33
33
|
assert_equal @server, config.server
|
@@ -35,7 +35,7 @@ class JsTestDriverConfigTest < Test::Unit::TestCase
|
|
35
35
|
|
36
36
|
should "raise error if no valid configuration is provided" do
|
37
37
|
assert_raise ArgumentError do
|
38
|
-
Jstdutil::
|
38
|
+
Jstdutil::JsTestDriver::Config.new "bogus"
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
data/test/test_helper.rb
CHANGED