rspec / rspec-support

Common code needed by the other RSpec gems. Not intended for direct use.
https://rspec.info
MIT License
95 stars 103 forks source link

Prevent warnings about encoding from preventing transfer of errors #575

Closed JonRowe closed 1 year ago

JonRowe commented 1 year ago

With rspec-rails using in_sub_process regularly masks errors by causing this internal error:

DEPRECATION WARNING: some output
 (called from block (3 levels) in <top (required)> at /home/runner/work/rspec-rails/rspec-rails/spec/rspec/rails/configuration_spec.rb:168)
/home/runner/work/rspec-rails/rspec-support/lib/rspec/support/spec/in_sub_process.rb:25:in `write': "\x98" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)

Which in turn masks the error as:

ArgumentError:
       marshal data too short

This fixes that and raises the proper error (in this case about the warnings about being present)

I tried to write a test for this but the encoding worked with all the invalid samples I can come up with, if someone can create one please feel free to add it.

JonRowe commented 5 months ago

This has been released in 3.12.2