Skip to content

Conversation

@KaanOzkan
Copy link
Contributor

No description provided.

@KaanOzkan KaanOzkan requested a review from a team as a code owner January 23, 2025 15:58
Copy link
Contributor

@Morriar Morriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add a test showing how Sorbet behaves when we run it? Maybe through tc test? https://github.com/Shopify/spoom/blob/cbe88be63783e0e593780b4151e6b98251de0f60/test/spoom/cli/srb/tc_test.rb

refute(result.status)

# Restore original config
@project.write!("sorbet/config", sorbet_config)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why removing the config didn't cause problems before. I can't find anywhere where we add . to the sorbet/config again.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why we need this, every test should be reinitialized with a proper config using new_project https://github.com/Shopify/spoom/blob/main/test/test_helper.rb#L18-L24.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it was called just once at the beginning

@project = T.let(new_project, TestProject)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you run the test, a new instance should be created for each test case so the initialize method should be called for each test_ method, you can put a print in new_project to confirm.

assert_equal("fake-branch", @project.git_current_branch)
end

def test_config_options_string
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Morriar I went with a coverage test since it uses the options parsing. This test checks that the metrics are altered after ignoring one of the files.

refute(result.status)

# Restore original config
@project.write!("sorbet/config", sorbet_config)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why we need this, every test should be reinitialized with a proper config using new_project https://github.com/Shopify/spoom/blob/main/test/test_helper.rb#L18-L24.

def test_config_options_string
sorbet_config = @project.read("sorbet/config")
# Add ignore path to config to test config options string
@project.write!("sorbet/config", "\n--ignore=lib/a.rb", append: true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we try with a wildcard * to show the expected behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done below as a new test.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The coverage tests are kind of expensive, do you mind merging both of them please?

@KaanOzkan KaanOzkan force-pushed the ko/quote-config branch 2 times, most recently from aa9fc58 to c4791d3 Compare January 24, 2025 18:54
@KaanOzkan KaanOzkan merged commit 06f9139 into main Jan 27, 2025
8 checks passed
@KaanOzkan KaanOzkan deleted the ko/quote-config branch January 27, 2025 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants