Skip to content

Commit 473f2b2

Browse files
committed
Merge pull request #53515 from k-tsuchiya-jp/fix-53467
Ensure proper output of traces for dasherized Rails application name
1 parent a122c47 commit 473f2b2

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

railties/lib/rails/backtrace_cleaner.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
module Rails
77
class BacktraceCleaner < ActiveSupport::BacktraceCleaner # :nodoc:
8-
APP_DIRS_PATTERN = /\A(?:\.\/)?(?:app|config|lib|test|\(\w*\))/
8+
APP_DIRS_PATTERN = /\A(?:\.\/)?(?:app|config|lib|test|\(\w+(?:-\w+)*\))/
99
RENDER_TEMPLATE_PATTERN = /:in [`'].*_\w+_{2,3}\d+_\d+'/
1010

1111
def initialize

railties/test/backtrace_cleaner_test.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ def setup
3636
assert_equal 2, result.length
3737
end
3838

39+
test "#clean should consider traces that include dasherized Rails application name" do
40+
backtrace = [ "(my-app):1",
41+
"/Path/to/rails/railties/lib/rails/commands/console.rb:77:in `start'",
42+
"bin/rails:4:in `<main>'" ]
43+
result = @cleaner.clean(backtrace)
44+
assert_equal "(my-app):1", result[0]
45+
assert_equal 1, result.length
46+
end
47+
3948
test "#clean should omit ActionView template methods names" do
4049
method_name = ActionView::Template.new(nil, "app/views/application/index.html.erb", nil, locals: []).send :method_name
4150
backtrace = [ "app/views/application/index.html.erb:4:in `block in #{method_name}'"]

0 commit comments

Comments
 (0)