mirror of
https://github.com/discourse/discourse.git
synced 2025-03-09 14:34:35 +00:00
DEV: Ignore prettier error when there are no ES6 files
This commit is contained in:
parent
0884cd218d
commit
d06ca90c94
@ -28,10 +28,10 @@
|
||||
# Run tests for a specific plugin (with a plugin mounted from host filesystem):
|
||||
# docker run -e SKIP_CORE=1 SINGLE_PLUGIN='my-awesome-plugin' -v $(pwd)/my-awesome-plugin:/var/www/discourse/plugins/my-awesome-plugin discourse/discourse_test:release
|
||||
|
||||
def run_or_fail(command)
|
||||
def run_or_fail(command, allowed_exit_codes: [0])
|
||||
pid = Process.spawn(command)
|
||||
Process.wait(pid)
|
||||
$?.exitstatus == 0
|
||||
allowed_exit_codes.include?($?.exitstatus)
|
||||
end
|
||||
|
||||
desc 'Run all tests (JS and code in a standalone environment)'
|
||||
@ -49,7 +49,7 @@ task 'docker:test' do
|
||||
@good &&= run_or_fail("yarn eslint --ext .es6 plugins/#{ENV['SINGLE_PLUGIN']}")
|
||||
|
||||
puts "Listing prettier offenses in #{ENV['SINGLE_PLUGIN']}:"
|
||||
@good &&= run_or_fail("yarn prettier --list-different 'plugins/#{ENV['SINGLE_PLUGIN']}/**/*.scss' 'plugins/#{ENV['SINGLE_PLUGIN']}/**/*.es6'")
|
||||
@good &&= run_or_fail("yarn prettier --list-different 'plugins/#{ENV['SINGLE_PLUGIN']}/**/*.scss' 'plugins/#{ENV['SINGLE_PLUGIN']}/**/*.es6'", allowed_exit_codes: [0, 2])
|
||||
else
|
||||
@good &&= run_or_fail("bundle exec rubocop --parallel") unless ENV["SKIP_CORE"]
|
||||
@good &&= run_or_fail("yarn eslint app/assets/javascripts test/javascripts") unless ENV["SKIP_CORE"]
|
||||
@ -62,7 +62,7 @@ task 'docker:test' do
|
||||
|
||||
unless ENV["SKIP_PLUGINS"]
|
||||
puts "Listing prettier offenses in plugins:"
|
||||
@good &&= run_or_fail('yarn prettier --list-different "plugins/**/*.scss" "plugins/**/*.es6"')
|
||||
@good &&= run_or_fail('yarn prettier --list-different "plugins/**/*.scss" "plugins/**/*.es6"', allowed_exit_codes: [0, 2])
|
||||
end
|
||||
end
|
||||
puts "travis_fold:end:lint" if ENV["TRAVIS"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user