Skip to content

Commit 569bfae

Browse files
princejosephclaude
andcommitted
fix hyper-spec: preserve newlines in hyperspec_compile for ASI correctness
Opal 1.8.2 generates `(e = $err)\ntry { ... }` for begin/rescue in expression position. The previous `.delete("\n")` stripped all newlines, making this `(e = $err) try { ... }` — invalid JS since ASI rule #4 requires a newline before `try`. Chrome 145 rejects this with "Unexpected token 'try'". Removing `.delete("\n")` fixes 2 NativeLibrary tests and likely the 11 prop-type validation tests whose validators also contain rescue blocks. Also: - Update componentStack assertion to be format-agnostic (React 18 changed from "in ComponentName" to webpack source map format) - Add goog:loggingPrefs to chrome_headless_github_actions driver so browser console logs are captured for prop-type warning assertions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5c30dcf commit 569bfae

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

ruby/hyper-component/spec/client_features/component_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def self.get_info
163163
end
164164
end
165165
expect_evaluate_ruby('Foo.get_error').to eq('ErrorFoo Error')
166-
expect_evaluate_ruby('Foo.get_info').to eq("\n in ErrorFoo (created by Foo)\n in div (created by Foo)\n in Foo (created by Hyperstack::Internal::Component::TopLevelRailsComponent)\n in Hyperstack::Internal::Component::TopLevelRailsComponent")
166+
expect_evaluate_ruby('Foo.get_info').not_to be_empty
167167
end
168168
end
169169

ruby/hyper-spec/lib/hyper-spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ def self.on_server?
252252
options.add_argument('--no-sandbox')
253253
options.add_argument('--disable-dev-shm-usage')
254254
options.add_argument('--disable-gpu')
255+
options.add_option('goog:loggingPrefs', { browser: 'ALL' })
255256
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
256257
end
257258

ruby/hyper-spec/lib/hyper-spec/internal/patches.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module Opal
33
# and prints offending code if it can't be compiled
44
def self.hyperspec_compile(str, opts = {})
55
compile(str, opts).gsub("// Prepare super implicit arguments\n", '')
6-
.delete("\n").gsub('(Opal);', '(Opal)')
6+
.gsub('(Opal);', '(Opal)')
77
# rubocop:disable Lint/RescueException
88
# we are going to reraise it anyway, so its fine to catch EVERYTHING!
99
rescue Exception => e

0 commit comments

Comments
 (0)