Shopify/tapioca

Better support for testing third-party compilers

franklinhu opened this issue · 2 comments

I understand that Tapioca compilers for third-party gems should live outside of the Tapioca repo (as per #1864), however it's difficult to write tests for those compilers since the test helpers available in this repo can't really be used outside or are not exported in the Tapioca gem.

For example, when trying to include Tapioca::Helpers::Test::DslCompiler in a third-party gem, this errors out due to private methods:

NoMethodError: private method `silence_warnings' called for module Tapioca
    /Users/franklin/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/tapioca-0.13.1/lib/tapioca/helpers/test/content.rb:34:in `block in add_ruby_file'

It'd be nice if this was a better supported path. Thanks!

I can't reproduce using

require "tapioca/internal"
require "tapioca/helpers/test/dsl_compiler"

include Tapioca::Helpers::Test::DslCompiler

Did you have those requires?

Cool looks like that fixes things up for me. Thank you!