Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make DSL compiler test helper work without needing an extra require #1963

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

paracycle
Copy link
Member

Motivation

Currently Tapioca exports a DSL compiler test helper that is used by other app or gems to test their DSL compilers. However, the helper requires a lot of Tapioca DSL classes to be defined before it can be used. This is a problem because it means that the helper can't be used in isolation, without the rest of Tapioca. A common workaround for this is to start requiring "tapioca/internal" in the test file that uses the helper, but that ends up causing Sorbet runtime related behaviour changes due to the Sorbet runtime patches that that require pulls in.

Implementation

In order to fix this, all we need to do is to require "tapioca/dsl" which brings in only the DSL classes that the helper needs. This way, the helper can be used in isolation without needing to require "tapioca/internal" and without causing any Sorbet runtime related behaviour changes.

Tests

No new tests

Currently Tapioca exports a DSL compiler test helper that is used by other app or gems to test their DSL compilers. However, the helper requires a lot of Tapioca DSL classes to be defined before it can be used. This is a problem because it means that the helper can't be used in isolation, without the rest of Tapioca. A common workaround for this is to start requiring "tapioca/internal" in the test file that uses the helper, but that ends up causing Sorbet runtime related behaviour changes due to the Sorbet runtime patches that that require pulls in.

In order to fix this, all we need to do is to require "tapioca/dsl" which brings in only the DSL classes that the helper needs. This way, the helper can be used in isolation without needing to require "tapioca/internal" and without causing any Sorbet runtime related behaviour changes.
@paracycle paracycle requested a review from a team as a code owner July 18, 2024 17:34
@paracycle paracycle merged commit 6a87a27 into main Jul 18, 2024
32 checks passed
@paracycle paracycle deleted the uk-fix-dsl-compiler-helper branch July 18, 2024 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants