-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathrunner.rb
55 lines (44 loc) · 1.55 KB
/
runner.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
require 'minitest'
require 'pathname'
require_relative 'test'
require_relative 'test_case'
class SassSpec::Runner
def initialize(options = {})
@options = options
end
def run
unless @options[:silent] || @options[:tap]
puts "Recursively searching under directory '#{@options[:spec_directory]}' for test files to test '#{@options[:engine_adapter]}' with."
puts @options[:engine_adapter].version
end
test_cases = _get_cases
SassSpec::Test.create_tests(test_cases, @options)
minioptions = []
if @options[:verbose]
minioptions.push '--verbose'
end
if @options[:tap]
require 'minitap'
Minitest.reporter = Minitap::TapY
end
exit Minitest.run(minioptions)
end
def _get_cases
cases = []
glob = File.join(@options[:spec_directory], "**", "#{@options[:input_file]}")
Dir.glob(glob) do |filename|
input = Pathname.new(filename)
@options[:output_styles].each do |output_style|
folder = File.dirname(filename)
output_file_name = @options["#{output_style}_output_file".to_sym]
expected_file_path = File.join(folder, output_file_name + ".css")
clean_file_name = File.join(folder, output_file_name + ".clean")
if File.file?(expected_file_path) && !File.file?(expected_file_path.sub(/\.css$/, ".skip")) && filename.include?(@options[:filter])
clean = File.file?(clean_file_name)
cases.push SassSpec::TestCase.new(input.realpath(), expected_file_path, output_style, clean, @options)
end
end
end
cases
end
end