Skip to content
代码片段 群组 项目
提交 d8d04719 编辑于 作者: Nao Hashizume's avatar Nao Hashizume 提交者: David Dieulivol
浏览文件

Add *.vue, *.md, and *.scss to allowlist to reuse frontend fixtures

上级 019d93f8
No related branches found
No related tags found
无相关合并请求
...@@ -118,7 +118,7 @@ function check_fixtures_download() { ...@@ -118,7 +118,7 @@ function check_fixtures_download() {
if [[ -z "${CI_MERGE_REQUEST_IID:-}" ]]; then if [[ -z "${CI_MERGE_REQUEST_IID:-}" ]]; then
return 1 return 1
else else
if tooling/bin/find_only_js_changes && ! fixtures_archive_doesnt_exist; then if tooling/bin/find_only_allowed_files_changes && ! fixtures_archive_doesnt_exist; then
return 0 return 0
else else
return 1 return 1
......
...@@ -182,8 +182,8 @@ ...@@ -182,8 +182,8 @@
end end
end end
describe '#only_js_files_changed' do describe '#only_allowed_files_changed' do
subject { instance.only_js_files_changed } subject { instance.only_allowed_files_changed }
context 'when fetching changes from changed files' do context 'when fetching changes from changed files' do
let(:from) { :changed_files } let(:from) { :changed_files }
...@@ -200,8 +200,16 @@ ...@@ -200,8 +200,16 @@
end end
end end
context 'when changed files contain not only *.js changes' do context 'when changed files contain both *.vue and *.js changes' do
let(:changed_files_file_content) { 'a.js b.rb' } let(:changed_files_file_content) { 'a.js b.vue' }
it 'returns true' do
expect(subject).to be true
end
end
context 'when changed files contain not allowed changes' do
let(:changed_files_file_content) { 'a.js b.vue c.rb' }
it 'returns false' do it 'returns false' do
expect(subject).to be false expect(subject).to be false
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
require_relative '../lib/tooling/find_changes' require_relative '../lib/tooling/find_changes'
if Tooling::FindChanges.new(from: :api).only_js_files_changed if Tooling::FindChanges.new(from: :api).only_allowed_files_changed
puts "Only JS files were changed" puts "Only files with extensions #{ALLOWED_FILE_TYPES.join(', ')} were changed"
exit 0 exit 0
else else
puts "Changes were made to files other than JS files" puts "Changes were made to files with extensions other than #{ALLOWED_FILE_TYPES.join(', ')}"
exit 1 exit 1
end end
...@@ -8,6 +8,8 @@ module Tooling ...@@ -8,6 +8,8 @@ module Tooling
class FindChanges class FindChanges
include Helpers::PredictiveTestsHelper include Helpers::PredictiveTestsHelper
ALLOWED_FILE_TYPES = ['.js', '.vue', '.md', '.scss'].freeze
def initialize( def initialize(
from:, from:,
changed_files_pathname: nil, changed_files_pathname: nil,
...@@ -41,8 +43,8 @@ def execute ...@@ -41,8 +43,8 @@ def execute
end end
end end
def only_js_files_changed def only_allowed_files_changed
file_changes.any? && file_changes.all? { |file| file.end_with?('.js') } file_changes.any? && file_changes.all? { |file| ALLOWED_FILE_TYPES.include?(File.extname(file)) }
end end
private private
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册