mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 15:25:35 +08:00
DEV: lint a bunch of files we missed
This commit is contained in:
parent
fc84e23b71
commit
5bc92296be
|
@ -1,5 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
task 'turbo:spec' => :test do |t|
|
task 'turbo:spec' => :test do |t|
|
||||||
require './lib/turbo_tests'
|
require './lib/turbo_tests'
|
||||||
|
|
||||||
TurboTests::Runner.run([{name: 'progress', outputs: ['-']}], ['spec'])
|
TurboTests::Runner.run([{ name: 'progress', outputs: ['-'] }], ['spec'])
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'open3'
|
require 'open3'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
require 'json'
|
require 'json'
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module TurboTests
|
module TurboTests
|
||||||
# An RSpec formatter used for each subprocess during parallel test execution
|
# An RSpec formatter used for each subprocess during parallel test execution
|
||||||
class JsonRowsFormatter
|
class JsonRowsFormatter
|
||||||
|
@ -50,37 +52,37 @@ module TurboTests
|
||||||
end
|
end
|
||||||
|
|
||||||
def example_passed(notification)
|
def example_passed(notification)
|
||||||
output_row({
|
output_row(
|
||||||
type: :example_passed,
|
type: :example_passed,
|
||||||
example: example_to_json(notification.example)
|
example: example_to_json(notification.example)
|
||||||
})
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def example_pending(notification)
|
def example_pending(notification)
|
||||||
output_row({
|
output_row(
|
||||||
type: :example_pending,
|
type: :example_pending,
|
||||||
example: example_to_json(notification.example)
|
example: example_to_json(notification.example)
|
||||||
})
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def example_failed(notification)
|
def example_failed(notification)
|
||||||
output_row({
|
output_row(
|
||||||
type: :example_failed,
|
type: :example_failed,
|
||||||
example: example_to_json(notification.example)
|
example: example_to_json(notification.example)
|
||||||
})
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def seed(notification)
|
def seed(notification)
|
||||||
output_row({
|
output_row(
|
||||||
type: :seed,
|
type: :seed,
|
||||||
seed: notification.seed,
|
seed: notification.seed,
|
||||||
})
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def close(notification)
|
def close(notification)
|
||||||
output_row({
|
output_row(
|
||||||
type: :close,
|
type: :close,
|
||||||
})
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module TurboTests
|
module TurboTests
|
||||||
class Reporter
|
class Reporter
|
||||||
def self.from_config(formatter_config, start_time)
|
def self.from_config(formatter_config, start_time)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module TurboTests
|
module TurboTests
|
||||||
class Runner
|
class Runner
|
||||||
def self.run(formatter_config, files, start_time=Time.now)
|
def self.run(formatter_config, files, start_time = Time.now)
|
||||||
reporter = Reporter.from_config(formatter_config, start_time)
|
reporter = Reporter.from_config(formatter_config, start_time)
|
||||||
|
|
||||||
new(reporter, files).run
|
new(reporter, files).run
|
||||||
|
@ -49,16 +51,19 @@ module TurboTests
|
||||||
|
|
||||||
def start_subprocess(tests, process_num)
|
def start_subprocess(tests, process_num)
|
||||||
if tests.empty?
|
if tests.empty?
|
||||||
@messages << {type: 'exit', process_num: process_num}
|
@messages << {
|
||||||
|
type: 'exit',
|
||||||
|
process_num: process_num
|
||||||
|
}
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
File.mkfifo("tmp/test-pipes/subprocess-#{process_num}")
|
File.mkfifo("tmp/test-pipes/subprocess-#{process_num}")
|
||||||
rescue Errno::EEXIST
|
rescue Errno::EEXIST
|
||||||
end
|
end
|
||||||
|
|
||||||
stdin, stdout, stderr, wait_thr =
|
_stdin, stdout, stderr, _wait_thr =
|
||||||
Open3.popen3(
|
Open3.popen3(
|
||||||
{'TEST_ENV_NUMBER' => process_num.to_s},
|
{ 'TEST_ENV_NUMBER' => process_num.to_s },
|
||||||
"bundle", "exec", "rspec",
|
"bundle", "exec", "rspec",
|
||||||
"-f", "TurboTests::JsonRowsFormatter",
|
"-f", "TurboTests::JsonRowsFormatter",
|
||||||
"-o", "tmp/test-pipes/subprocess-#{process_num}",
|
"-o", "tmp/test-pipes/subprocess-#{process_num}",
|
||||||
|
@ -76,7 +81,7 @@ module TurboTests
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@messages << {type: 'exit', process_num: process_num}
|
@messages << { type: 'exit', process_num: process_num }
|
||||||
end
|
end
|
||||||
|
|
||||||
@threads << start_copy_thread(stdout, STDOUT)
|
@threads << start_copy_thread(stdout, STDOUT)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user