Commit 4fafca23 authored by Rémy Coutable's avatar Rémy Coutable

Don't fail check_if_qa_only_spec_changes if changed_files.txt missing

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 18fc6343
...@@ -6,13 +6,17 @@ ...@@ -6,13 +6,17 @@
# all the files are end-to-end test spec files. # all the files are end-to-end test spec files.
abort("ERROR: Please specify the file containing the list of changed files and a file where the qa only spec files will be written") if ARGV.size != 2 abort("ERROR: Please specify the file containing the list of changed files and a file where the qa only spec files will be written") if ARGV.size != 2
file_contents = File.read(ARGV.shift).split(' ')
all_files_are_qa_specs = file_contents.all? { |file_path| file_path =~ %r{^qa\/qa\/specs\/features\/} }
changed_files_path = ARGV.shift
output_file = ARGV.shift output_file = ARGV.shift
return unless File.exist?(changed_files_path)
changed_files = File.read(changed_files_path).split(' ')
all_files_are_qa_specs = changed_files.all? { |file_path| file_path =~ %r{^qa\/qa\/specs\/features\/} }
if all_files_are_qa_specs if all_files_are_qa_specs
qa_spec_paths_trimmed = file_contents.map { |path| path.sub('qa/', '') } qa_spec_paths_trimmed = changed_files.map { |path| path.sub('qa/', '') }
File.write(output_file, qa_spec_paths_trimmed.join(' ')) File.write(output_file, qa_spec_paths_trimmed.join(' '))
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment