Skip to content

Commit e7c6594

Browse files
committed
Rebuilding test suite
1 parent 2bcf8e5 commit e7c6594

28 files changed

+9188
-158
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ log/
1313
ninjascript-testlibs.tar.gz
1414
ninjascript.zip
1515
pkg/
16+
src/deps.js
17+
legacy-spec-main.js
18+
dependency.MF
19+
jsTestDriver.conf

.gitmodules

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[submodule "buildtools/js-test-driver"]
2+
path = buildtools/js-test-driver
3+
url = https://code.google.com/p/js-test-driver/
4+
[submodule "buildtools/jasmine-jstd-adapter"]
5+
path = buildtools/jasmine-jstd-adapter
6+
url = git://github.com/ibolmo/jasmine-jstd-adapter.git
7+
[submodule "buildtools/jasmine-jquery"]
8+
path = buildtools/jasmine-jquery
9+
url = git://github.com/velesin/jasmine-jquery.git
10+
[submodule "buildtools/jasmine-ajax"]
11+
path = buildtools/jasmine-ajax
12+
url = https://github.com/pivotal/jasmine-ajax
13+
[submodule "buildtools/closure-compiler"]
14+
path = buildtools/closure-compiler
15+
url = git://github.com/adinardi/google-closure-compiler.git
16+
[submodule "buildtools/google-closure-library"]
17+
path = buildtools/google-closure-library
18+
url = git://github.com/jarib/google-closure-library.git
19+
[submodule "buildtools/jasmine-1.2.0"]
20+
path = buildtools/jasmine-1.2.0
21+
url = git://github.com/pivotal/jasmine.git
22+
[submodule "buildtools/sinon"]
23+
path = buildtools/sinon
24+
url = git://github.com/cjohansen/Sinon.JS.git
25+
[submodule "buildtools/jasmine-sinon"]
26+
path = buildtools/jasmine-sinon
27+
url = git://github.com/froots/jasmine-sinon.git

Rakefile

+82-16
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,70 @@ namespace :stylesheets do
4646
end
4747
end
4848

49+
BUILDTOOLS_DIR = "buildtools"
50+
JS_TEST_DRIVER_DIR = File::join(BUILDTOOLS_DIR, "js-test-driver/JsTestDriver")
51+
JS_TEST_DRIVER_JAR = File::join(JS_TEST_DRIVER_DIR, "target/bin/JsTestDriver.jar")
52+
CLOSURE_COMPILER_DIR = File::join(BUILDTOOLS_DIR, "closure-compiler")
53+
CLOSURE_JAR = File::join(CLOSURE_COMPILER_DIR, "build", "compiler.jar")
54+
CLOSURE_DIR = File::join(BUILDTOOLS_DIR, "google-closure-library/closure")
55+
CLOSURE_DEPSWRITER = File::join(CLOSURE_DIR, "bin/build/depswriter.py")
56+
CLOSURE_LIBRARY_DIR = File::join(CLOSURE_DIR, "goog")
57+
CLOSURE_DOTS = File::join(*(%w{..} * CLOSURE_LIBRARY_DIR.split(File::Separator).length))
58+
59+
namespace :test do
60+
desc "Run JSTestDriver Server"
61+
task :server => 'jsTestDriver.conf' do
62+
puts %x{/bin/env java -jar #{JS_TEST_DRIVER_JAR} --port 9876 &}
63+
end
64+
65+
desc "Run chrome against server"
66+
task :chromium do
67+
%x{/bin/env chromium --new-window localhost:9876/capture &}
68+
end
69+
70+
desc "Run firefox against server"
71+
task :firefox do
72+
%x{/bin/env firefox localhost:9876/capture &}
73+
end
74+
75+
desc "Run tests against JSTestDriver"
76+
task :run, [:tests] => %w'src/deps.js jsTestDriver.conf' do |task, args|
77+
if args[:tests]
78+
tests = args[:tests]
79+
else
80+
"all"
81+
end
82+
sh %{/bin/env java -jar #{JS_TEST_DRIVER_JAR} --captureConsole --runnerMode DEBUG --tests "#{tests}"}
83+
end
84+
85+
end
86+
87+
task :buildtools => %w{buildtools:jstestdriver buildtools:jstestdriver_coverage buildtools:closure_compiler}
88+
89+
namespace :buildtools do
90+
task :jstestdriver do
91+
chdir JS_TEST_DRIVER_DIR do
92+
puts "Running ant"
93+
puts %x{ant jstestdriver}
94+
end
95+
end
96+
97+
task :jstestdriver_coverage do
98+
chdir JS_TEST_DRIVER_DIR do
99+
puts "Running ant"
100+
puts %x{ant jstestdriver-coverage}
101+
end
102+
end
103+
104+
105+
task :closure_compiler do
106+
chdir CLOSURE_COMPILER_DIR do
107+
puts "Running ant"
108+
puts %x{ant jar}
109+
end
110+
end
111+
end
112+
49113
namespace :build do
50114

51115
directory "generated/javascript"
@@ -79,6 +143,24 @@ namespace :build do
79143
end
80144
end
81145

146+
file "src/deps.js" => sourcefiles do |file|
147+
%x{/bin/env #{CLOSURE_DEPSWRITER} --root_with_prefix="src/javascript #{CLOSURE_DOTS}/src/javascript" > #{file}}
148+
end
149+
150+
file "dependency.MF" => sourcefiles do |file|
151+
sh %{/bin/env java -jar #{CLOSURE_JAR} #{sourcefiles.map{|src| "--js #{src}"}.join(" ")} --output_manifest #{file}}
152+
end
153+
154+
file 'jsTestDriver.conf' => ['jsTestDriver.yaml', 'dependency.MF'] do |cfg|
155+
require 'yaml'
156+
jstd_conf = YAML::load(File::read('jsTestDriver.yaml'))
157+
deps = File::read("dependency.MF").lines.map{|line| line.chomp}
158+
jstd_conf['load'] += deps
159+
File::open(cfg.name, 'w') do |file|
160+
file.write(YAML::dump(jstd_conf))
161+
end
162+
end
163+
82164
task :clobber_header_comments do
83165
rm_f 'tmp/header-comments.js'
84166
end
@@ -99,22 +181,6 @@ namespace :build do
99181
desc "Build Ninjascript & assets"
100182
task :project => %w{stylesheets:generate clobber_header_comments generated/javascript/ninjascript.js generated/javascript/ns.min.js}
101183

102-
task :sprockets => %w{stylesheets:generate generated/javascript constants} do
103-
raise "This is an old task, scheduled for deletion"
104-
require 'sprockets'
105-
106-
sec = Sprockets::Secretary.new(
107-
:root => '.',
108-
:asset_root => ASSET_ROOT,
109-
:load_path => %w[src/javascript vendor auto-constants],
110-
:source_files => %w[src/javascript/main.js]
111-
)
112-
113-
puts "Saving concatentated javascript"
114-
sec.concatenation.save_to("#{ASSET_ROOT}/javascript/ninjascript.js")
115-
sec.install_assets
116-
end
117-
118184
require 'rake/packagetask'
119185
Rake::PackageTask.new('ninjascript', PACKAGE_CONFIG["VERSION"]) do |t|
120186
t.need_zip = true

SpecRunner-local.html

+40-17
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,48 @@
11
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2-
"http://www.w3.org/TR/html4/loose.dtd">
2+
"http://www.w3.org/TR/html4/loose.dtd">
33
<html>
4-
<head>
5-
<title>NinjaScript Jasmine Test Runner</title>
6-
<link rel="stylesheet" type="text/css" href="libs/jasmine-1.0.1/jasmine.css">
7-
<script type="text/javascript" src="libs/console-stub.js"></script>
8-
9-
<!-- <script type="text/javascript" src="libs/jquery-1.4.2.js"></script> -->
10-
<!-- <script type="text/javascript" src="libs/jquery-1.4.3.js"></script> -->
11-
<!-- <script type="text/javascript" src="libs/jquery-1.5.js"></script> -->
12-
<script type="text/javascript" src="libs/jquery-1.6.1.js"></script>
13-
14-
<script type="text/javascript" src="libs/closure-library/closure/goog/base.js"></script>
15-
<script type="text/javascript" src="deps.js"></script>
16-
17-
<script type="text/javascript">
18-
goog.require('ninjascript.loaded')
19-
</script>
4+
<head>
5+
<title>NinjaScript Jasmine Test Runner</title>
6+
<link rel="stylesheet" type="text/css" href="libs/jasmine-1.0.1/jasmine.css">
7+
<script type="text/javascript" src="http://js-testing.lrdesign.com/libs/jasmine-1.0.1/jasmine.js"></script>
8+
<script type="text/javascript" src="libs/console-stub.js"></script>
9+
10+
<script type="text/javascript" src="libs/jquery-1.6.1.js"></script>
11+
<script type="text/javascript" src="http://js-testing.lrdesign.com/libs/jasmine-jquery-1.1.2.js"></script>
12+
<script src="http://js-testing.lrdesign.com/libs/jasmine-ajax/mock-ajax.js" type="text/javascript" charset="utf-8"></script>
13+
<script type="text/javascript" src="http://js-testing.lrdesign.com/libs/jasmine-1.0.1/jasmine-html.js"></script>
14+
15+
<!-- end test setup -->
16+
17+
18+
<!-- source files -->
19+
<script type="text/javascript" src="libs/closure-library/closure/goog/base.js"></script>
20+
<script type="text/javascript" src="deps.js"></script>
21+
22+
<script type="text/javascript">
23+
goog.require('ninjascript.loaded')
24+
</script>
25+
<!-- end source -->
26+
27+
<!-- include spec files here... -->
28+
<script src="spec-setup.js" type="text/javascript" charset="utf-8"></script>
29+
<script type="text/javascript" src="spec/ajax_submitter.js"></script>
30+
<script type="text/javascript" src="spec/packaged_behaviors.js"></script>
31+
<script type="text/javascript" src="spec/metabehaviors.js"></script>
32+
<script type="text/javascript" src="spec/overlays.js"></script>
33+
<script type="text/javascript" src="spec/ninja_tools.js"></script>
34+
<script type="text/javascript" src="spec/priority.js"></script>
35+
<script type="text/javascript" src="spec/composing-event-handlers.js"></script>
36+
<script type="text/javascript" src="spec/ajax_to_json.js"></script>
37+
38+
2039
</head>
2140
<body>
2241

42+
<script type="text/javascript">
43+
jasmine.getEnv().addReporter(new jasmine.TrivialReporter());
44+
jasmine.getEnv().execute();
45+
</script>
2346

2447
</body>
2548
</html>

buildtools/closure-compiler

Submodule closure-compiler added at d255c59

buildtools/google-closure-library

Submodule google-closure-library added at 637e46b

buildtools/jasmine-1.2.0

Submodule jasmine-1.2.0 added at 8b02bf7

buildtools/jasmine-ajax

Submodule jasmine-ajax added at ddd5c50

buildtools/jasmine-jquery

Submodule jasmine-jquery added at c7fd7cf

buildtools/jasmine-jstd-adapter

Submodule jasmine-jstd-adapter added at 19fc291

buildtools/jasmine-sinon

Submodule jasmine-sinon added at 9b4e935

0 commit comments

Comments
 (0)