Shopify/packwerk

[Bug Report]

crystal-williams-brown opened this issue · 2 comments

Description
I'm attempting to modularize a Rails app. I am starting with one section. I moved the files into a single folder. I installed packwerk and packs-rails. I placed the folder with the files inside of a packs folder at the root of the app. I moved the test files into an rspec folder inside of the section folder. My test fail with the error NameError: uninitialized constant for every single class. All of these classes are in the folder. I don't know why the tests are not treating them like classes.

To Reproduce

  1. move class files into a folder within the packs folder
  2. Add a package.yml turn on engine setting
  3. Add test files and tell rspec to include packs-rails
  4. Run tests and watch them fail

Expected Behaviour
I expected the tests to still recognize the class names though they are moved into a pack.

Screenshots
This is the package.yml in the pack folder
Screenshot 2023-06-06 at 6 41 00 PM

And here is the one at the root
Screenshot 2023-06-06 at 6 41 12 PM

Here is the file system
Screenshot 2023-06-06 at 6 34 17 PM

Here is the .rspec
Screenshot 2023-06-06 at 6 42 35 PM

Here is one of the failing tests
Screenshot 2023-06-06 at 6 35 43 PM

Version Information

  • Packwerk: 3.0.1
  • Ruby 3.2.2

Additional Context
I've tried directly requiring packwerk in the files, having the test files specify they are model tests, moving files around, and changing the names of classes. I've also started over from scratch, following the guidance in the instructions and using different tutorials.

This is probably an issue on packs. Packwerk doesn't do anything to load code. It is a static analysis tool. Could you please open an issue there?

Sorry, I moved it to packs-rails rubyatscale/packs-rails#64