qunited 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +13 -0
- data/Gemfile +4 -0
- data/Rakefile +9 -0
- data/bin/qunited +23 -0
- data/lib/qunited/js_runner/base.rb +34 -0
- data/lib/qunited/js_runner/rhino/js/env.rhino.js +14006 -0
- data/lib/qunited/js_runner/rhino/js/js.jar +0 -0
- data/lib/qunited/js_runner/rhino/js/qunit-runner.js +168 -0
- data/lib/qunited/js_runner/rhino/js/qunit.js +1838 -0
- data/lib/qunited/js_runner/rhino/js/yaml.js +22 -0
- data/lib/qunited/js_runner/rhino.rb +65 -0
- data/lib/qunited/js_runner.rb +2 -0
- data/lib/qunited/rake_task.rb +87 -0
- data/lib/qunited/results.rb +164 -0
- data/lib/qunited/runner.rb +23 -0
- data/lib/qunited/version.rb +3 -0
- data/lib/qunited.rb +4 -0
- data/qunited.gemspec +20 -0
- data/test/fixtures/basic_project/app/assets/javascripts/application.js +6 -0
- data/test/fixtures/basic_project/test/javascripts/test_basics.js +6 -0
- data/test/fixtures/basic_project/test/javascripts/test_math.js +12 -0
- data/test/fixtures/dom_project/app/assets/javascripts/application.js +6 -0
- data/test/fixtures/dom_project/test/javascripts/test_misc.js +5 -0
- data/test/fixtures/errors_project/app/assets/javascripts/no_error.js +5 -0
- data/test/fixtures/errors_project/app/assets/javascripts/syntax_error.js +7 -0
- data/test/fixtures/errors_project/app/assets/javascripts/undefined_error.js +9 -0
- data/test/fixtures/errors_project/test/javascripts/this_test_has_no_errors_in_it.js +5 -0
- data/test/fixtures/errors_project/test/javascripts/this_test_has_no_tests.js +4 -0
- data/test/fixtures/errors_project/test/javascripts/this_test_has_syntax_error.js +10 -0
- data/test/fixtures/errors_project/test/javascripts/this_test_has_undefined_error.js +10 -0
- data/test/fixtures/failures_project/app/assets/javascripts/application.js +5 -0
- data/test/fixtures/failures_project/test/javascripts/test_basics.js +11 -0
- data/test/fixtures/failures_project/test/javascripts/test_math.js +12 -0
- data/test/test_helper.rb +5 -0
- data/test/unit/test_results.rb +338 -0
- data/test/unit/test_rhino_runner.rb +114 -0
- metadata +100 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/bin/qunited
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'qunited'
|
3
|
+
|
4
|
+
if ARGV.empty? || ARGV.include?('-h') || ARGV.include?('--help')
|
5
|
+
puts <<-HELP_TEXT
|
6
|
+
Usage: qunited [OPTIONS] [JS_SOURCE_FILES...] -- [JS_TEST_FILES..]
|
7
|
+
|
8
|
+
Runs JavaScript unit tests with QUnit.
|
9
|
+
|
10
|
+
JS_SOURCE_FILES are the JavaScript files that you want to test. They will all be
|
11
|
+
loaded for running each test.
|
12
|
+
|
13
|
+
JS_TEST_FILES are files that contain the QUnit tests to run.
|
14
|
+
and (optional) NAME
|
15
|
+
|
16
|
+
Options:
|
17
|
+
-h, --help Show this message
|
18
|
+
HELP_TEXT
|
19
|
+
exit
|
20
|
+
end
|
21
|
+
|
22
|
+
js_source_files, js_test_files = ARGV.join(' ').split('--').map { |file_list| file_list.split(' ') }
|
23
|
+
exit QUnited::Runner.run(js_source_files, js_test_files)
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module QUnited
|
2
|
+
module JsRunner
|
3
|
+
class Base
|
4
|
+
attr_reader :results
|
5
|
+
|
6
|
+
# Array of file names? Glob pattern?
|
7
|
+
def initialize(source_files, test_files)
|
8
|
+
@source_files = if source_files.is_a? String
|
9
|
+
Dir.glob(source_files)
|
10
|
+
elsif source_files.is_a? Array
|
11
|
+
source_files
|
12
|
+
end
|
13
|
+
|
14
|
+
@test_files = if test_files.is_a? String
|
15
|
+
Dir.glob(test_files)
|
16
|
+
elsif test_files.is_a? Array
|
17
|
+
test_files
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def can_run?
|
22
|
+
false
|
23
|
+
end
|
24
|
+
|
25
|
+
def name
|
26
|
+
self.class.name.split('::')[-1]
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
raise 'run not implemented'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|