Commit c9307db9 authored by Lin Jen-Shin's avatar Lin Jen-Shin Committed by Rémy Coutable

Always require spec_helper first in CI

This can prevent from requiring fast_spec_helper before
requiring spec_helper, and in that case it'll break.
(Rails cannot be properly loaded this way)
parent 3bb8e20d
......@@ -90,7 +90,7 @@ function rspec_simple_job() {
export NO_KNAPSACK="1"
bin/rspec --color --format documentation --format RspecJunitFormatter --out junit_rspec.xml ${rspec_opts}
bin/rspec -Ispec -rspec_helper --color --format documentation --format RspecJunitFormatter --out junit_rspec.xml ${rspec_opts}
}
function rspec_paralellized_job() {
......@@ -143,7 +143,7 @@ function rspec_paralellized_job() {
export MEMORY_TEST_PATH="tmp/memory_test/${report_name}_memory.csv"
knapsack rspec "-Ispec --color --format documentation --format RspecJunitFormatter --out junit_rspec.xml ${rspec_opts}"
knapsack rspec "-Ispec -rspec_helper --color --format documentation --format RspecJunitFormatter --out junit_rspec.xml ${rspec_opts}"
date
}
......
# frozen_string_literal: true
# When running in CI environment, we need to load a full `spec_helper`
if ENV['CI']
require_relative 'spec_helper'
# $" is $LOADED_FEATURES, but RuboCop didn't like it
if $".include?(File.expand_path('spec_helper.rb', __dir__))
# There's no need to load anything here if spec_helper is already loaded
# because spec_helper is more extensive than fast_spec_helper
return
end
......
# frozen_string_literal: true
# $" is $LOADED_FEATURES, but RuboCop didn't like it
if $".include?(File.expand_path('fast_spec_helper.rb', __dir__))
warn 'Detected fast_spec_helper is loaded first than spec_helper.'
warn 'If running test files using both spec_helper and fast_spec_helper,'
warn 'make sure test file with spec_helper is loaded first.'
abort 'Aborting...'
end
require './spec/simplecov_env'
SimpleCovEnv.start!
......
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