-
Notifications
You must be signed in to change notification settings - Fork 1
/
rakefile.rb
64 lines (45 loc) · 1.45 KB
/
rakefile.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
gem 'albacore', '=0.2.6'
require 'albacore'
require 'rake'
require 'yaml'
require 'os'
$ROOT = File.expand_path(Dir.pwd)
puts 'Root path is ' + $ROOT
task :default => ["js_unit_test"]
task :js_unit_test do
require 'pathname'
puts "============================================================="
puts "Running javascript tests ..."
testsFiles = File.join($ROOT, 'Source/Scripts.Test/spec/*.html')
puts ''
puts "Test file pattern: " + testsFiles
puts ''
Dir.chdir(File.join($ROOT, 'AutoTools'))
i = 0
Dir.glob(testsFiles) do |item|
next if item == '.' or item == '..'
i = i+1
phantomjs = OS.mac? ? 'phantomjs' : File.join($ROOT, 'AutoTools/phantomjs.exe')
command = phantomjs + ' ' + File.join($ROOT, 'AutoTools/Scripts/run-jasmine.js') + ' ' +
((Pathname.new item).relative_path_from (Pathname.new File.join($ROOT, 'AutoTools'))).to_s
puts ''
puts '----------------------------------------------------------'
puts ' Running test file ' + i.to_s + '...'
puts ' ' + command + ''
system command
puts $?
if !($? == nil) && $?.pid == 0 then
raise 'Failed to start ' + command
end
if !($? == nil) && $?.exitstatus != 0 then
raise 'JavaScript tests failed!'
end
puts '-----------------------------------------------------------'
puts ''
end
if(i == 0) then
raise 'No js test files are found!'
end
puts "JavaScript tests passed. :) total test files: " + i.to_s
puts "============================================================="
end