fix the determination of spec files for line number analysis
This commit is contained in:
parent
7bd6894397
commit
dc134dcf24
@ -4,7 +4,7 @@ require 'time'
|
||||
|
||||
module Jasmine
|
||||
class FilesList
|
||||
attr_reader :files, :filtered_files, :spec_outside_scope
|
||||
attr_reader :files, :spec_files, :filtered_files, :spec_outside_scope
|
||||
|
||||
DEFAULT_FILES = [
|
||||
File.join(Jasmine::Core.path, "jasmine.js"),
|
||||
@ -100,15 +100,17 @@ module Jasmine
|
||||
@files += found_files
|
||||
|
||||
if searches == 'spec_files'
|
||||
@spec_files += spec_filter
|
||||
@spec_files += spec_filter.empty? ? found_files : (found_files & spec_filter)
|
||||
end
|
||||
|
||||
@filtered_files += (if searches == 'spec_files'
|
||||
@spec_outside_scope = ((spec_filter | found_files).sort != found_files.sort)
|
||||
spec_filter.empty? ? found_files : (spec_filter || found_files)
|
||||
else
|
||||
found_files
|
||||
end)
|
||||
@filtered_files += begin
|
||||
if searches == 'spec_files'
|
||||
@spec_outside_scope = ((spec_filter | found_files).sort != found_files.sort)
|
||||
spec_filter.empty? ? found_files : (spec_filter || found_files)
|
||||
else
|
||||
found_files
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -36,6 +36,7 @@ describe Jasmine::FilesList do
|
||||
|
||||
before do
|
||||
[ first_file, src_file, spec_file, helper_file, stylesheet_file ].each do |file|
|
||||
FileUtils.mkdir_p File.split(file).first
|
||||
File.open(file, 'w')
|
||||
end
|
||||
end
|
||||
@ -49,6 +50,8 @@ describe Jasmine::FilesList do
|
||||
File.expand_path(helper_file),
|
||||
File.expand_path(spec_file)
|
||||
]
|
||||
|
||||
files_list.spec_files.should == [ File.expand_path(spec_file) ]
|
||||
end
|
||||
end
|
||||
|
||||
@ -90,8 +93,11 @@ describe Jasmine::FilesList do
|
||||
'spec_dir' => spec_dir
|
||||
} }
|
||||
|
||||
let(:spec_files) { %w{one_spec.js two_spec.js whatever.js} }
|
||||
|
||||
before do
|
||||
%w{one_spec.js two_spec.js whatever.js}.each do |file|
|
||||
spec_files.each do |file|
|
||||
FileUtils.mkdir_p spec_dir
|
||||
File.open(File.join(spec_dir, file), 'w')
|
||||
end
|
||||
end
|
||||
@ -103,6 +109,7 @@ describe Jasmine::FilesList do
|
||||
files_list.files.any? { |file| file['two_spec.js'] }.should be_true
|
||||
files_list.filtered?.should be_false
|
||||
files_list.should_not have_spec_outside_scope
|
||||
files_list.spec_files.sort.should == %w{one_spec.js two_spec.js}.sort.collect { |file| File.expand_path(File.join(spec_dir, file)) }
|
||||
end
|
||||
end
|
||||
|
||||
@ -113,6 +120,7 @@ describe Jasmine::FilesList do
|
||||
files_list.files.any? { |file| file['two_spec.js'] }.should be_true
|
||||
files_list.filtered?.should be_true
|
||||
files_list.should_not have_spec_outside_scope
|
||||
files_list.spec_files.should == filter
|
||||
end
|
||||
|
||||
it 'should return only filtered files for filtered_files' do
|
||||
|
@ -59,6 +59,7 @@ describe Jasmine::Headless::CacheableAction do
|
||||
let(:cache_file_mtime) { 15 }
|
||||
|
||||
before do
|
||||
FileUtils.mkdir_p File.split(cache_file).first
|
||||
File.open(cache_file, 'wb') { |fh| fh.print compiled }
|
||||
end
|
||||
|
||||
|
@ -52,6 +52,9 @@ describe Jasmine::Headless::Options do
|
||||
let(:test_data) { '-j test' }
|
||||
|
||||
before do
|
||||
FileUtils.mkdir_p File.split(Jasmine::Headless::Options::GLOBAL_DEFAULTS_FILE).first
|
||||
FileUtils.mkdir_p File.split(Jasmine::Headless::Options::DEFAULTS_FILE).first
|
||||
|
||||
File.open(Jasmine::Headless::Options::GLOBAL_DEFAULTS_FILE, 'w') { |fh| fh.puts global_test_data }
|
||||
File.open(Jasmine::Headless::Options::DEFAULTS_FILE, 'w') { |fh| fh.puts test_data }
|
||||
end
|
||||
|
@ -18,8 +18,12 @@ describe Jasmine::Headless::Runner do
|
||||
describe '#load_config' do
|
||||
include FakeFS::SpecHelpers
|
||||
|
||||
let(:runner_filename) { 'ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner' }
|
||||
|
||||
before do
|
||||
File.open('ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner', 'w')
|
||||
FileUtils.mkdir_p File.split(runner_filename).first
|
||||
|
||||
File.open(runner_filename, 'w')
|
||||
end
|
||||
|
||||
let(:config_filename) { 'test.yml' }
|
||||
|
Loading…
Reference in New Issue
Block a user