Shopify / packwerk

Good things come in small packages.
MIT License
1.54k stars 111 forks source link

[Bug Report] #358

Closed crystal-williams-brown closed 1 year ago

crystal-williams-brown commented 1 year ago

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

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.

rafaelfranca commented 1 year ago

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?

crystal-williams-brown commented 1 year ago

Sorry, I moved it to packs-rails https://github.com/rubyatscale/packs-rails/issues/64