-
Notifications
You must be signed in to change notification settings - Fork 120
Description
I was testing the pin_all_from method and found what might be a potential issue. pin_all_from requires both the :to and :under options to be passed for this test case to pass:
importmap-rails/test/importmap_test.rb
Lines 50 to 53 in 27236e3
| test "directory pin under custom asset path" do | |
| assert_match %r|assets/spina/controllers/another_controller-.*\.js|, generate_importmap_json["imports"]["controllers/spina/another_controller"] | |
| assert_match %r|assets/spina/controllers/deeper/again_controller-.*\.js|, generate_importmap_json["imports"]["controllers/spina/deeper/again_controller"] | |
| end |
This is also apparent by removing the line:
importmap-rails/test/importmap_test.rb
Line 13 in 27236e3
| pin_all_from "app/javascript/spina/controllers", under: "controllers/spina", preload: true |
from the setup and noticing that the tests still pass. I also verified it by creating a new Rails 7 app and adding both the lines:
importmap-rails/test/importmap_test.rb
Lines 13 to 14 in 27236e3
| pin_all_from "app/javascript/spina/controllers", under: "controllers/spina", preload: true | |
| pin_all_from "app/javascript/spina/controllers", under: "controllers/spina", to: "spina/controllers", preload: true |
to config/importmap.rb and running bin/importmap json. Commenting out the second line doesn't generate any imports but commenting out the first line does.