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

Test dartsass:install command #49

Merged
merged 2 commits into from
Dec 28, 2023
Merged

Conversation

jonathanhefner
Copy link
Member

@jonathanhefner jonathanhefner commented Dec 3, 2023

This PR looks large because this project currently has no testing infrastructure. The vast majority of LOC in this PR are from Gemfile and Gemfile.lock files. I have split the PR into two commits to further clarify. The latter commit has the actual testing code, which amounts to ~70 lines of test code + ~70 lines of helper code.


This adds test coverage for the dartsass:install command. The command is tested against a freshly generated Rails app using the version of Rails that is currently loaded. Thus the installer can be tested with different versions of Rails in CI.

Infrastructure has been added to run tests against Rails 6.1, 7.0, 7.1, and main branch, all with both Sprockets and Propshaft.

@jonathanhefner
Copy link
Member Author

I am seeing test failures when running the GitHub CI workflow in my own fork, but only with Ruby 3.0 and Rails >= 7.1. I'm not sure what is happening, but it's something related to Bundler (the bundle command is the point of failure). I will investigate further.

Comment on lines +42 to +48
# This prevents a "Failed to build gem native extension" error when
# running `bundle install` inside a Rails app that is generated for
# testing. The error occurs only in CI, and only when using Ruby 3.0 and
# Rails >= 7.1.
- name: Install sass-embedded gem
if: ${{ matrix.ruby-version == '3.0' }}
run: gem install sass-embedded
Copy link
Member Author

Choose a reason for hiding this comment

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

The underlying cause is unclear, but this is the resolution to my previous comment.

This adds testing infrastructure to test against multiple versions of
Rails, including Rails `main` branch.
This adds test coverage for the `dartsass:install` command.  The command
is tested against a freshly generated Rails app using the version of
Rails that is currently loaded.  Thus the installer can be tested with
different versions of Rails in CI.
Copy link

@rud rud left a comment

Choose a reason for hiding this comment

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

This is magnificent!

@dhh
Copy link
Member

dhh commented Dec 28, 2023

@jonathanhefner did you get all the variations to pass?

@jonathanhefner
Copy link
Member Author

@dhh Yes: https://github.com/jonathanhefner/dartsass-rails/actions/runs/7089553301.

I did not merge because I do not have commit permissions for this repo. 😄

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.

3 participants