mirror of
https://github.com/discourse/discourse.git
synced 2026-08-12 05:37:26 +08:00
We already automatically set LOAD_PLUGINS=1 when detecting a spec run in plugins/blah inside the discourse repo dir, but often plugins are in different folders on the system. This is especially annoying when you have e.g. vscode open in a directory and it runs a spec command like bin/rspec /absolute/path/to/repo/spec/blah_spec.rb, which doesn't trigger the LOAD_PLUGIN=1 logic. This change makes it so any spec path that is either in plugins/ or not in DISCOURSE_REPO_BASE_DIRECTORY will automaticlaly trigger LOAD_PLUGIN=1
32 lines
921 B
Ruby
Executable file
Vendored
32 lines
921 B
Ruby
Executable file
Vendored
#!/usr/bin/env ruby
|
|
# frozen_string_literal: true
|
|
|
|
#
|
|
# This file was generated by Bundler.
|
|
#
|
|
# The application 'rspec' is installed as part of a gem, and
|
|
# this file is here to facilitate running it.
|
|
#
|
|
|
|
require "pathname"
|
|
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpath)
|
|
|
|
require "rubygems"
|
|
require "bundler/setup"
|
|
|
|
if ENV["LOAD_PLUGINS"].nil? &&
|
|
ARGV.any? { |pattern|
|
|
pattern.include?("plugins/") ||
|
|
(
|
|
ENV.key?("DISCOURSE_REPO_BASE_DIRECTORY") &&
|
|
!pattern.include?(ENV["DISCOURSE_REPO_BASE_DIRECTORY"] + "/spec")
|
|
)
|
|
}
|
|
STDERR.puts "Detected plugin spec path, setting LOAD_PLUGINS to 1"
|
|
ENV["LOAD_PLUGINS"] = "1"
|
|
end
|
|
|
|
ENV["PLAYWRIGHT_HEADLESS"] = "0" if ARGV.delete("--headful")
|
|
ENV["CAPYBARA_PLAYWRIGHT_DEBUG_CLIENT_SETTLED"] = "1" if ARGV.delete("--debug-client-settled")
|
|
|
|
load Gem.bin_path("rspec-core", "rspec")
|