Skip to content

Commit a5dd1c3

Browse files
Add tests to validate CSS module handling in pack generator (#1775)
1 parent b97c854 commit a5dd1c3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

spec/dummy/spec/packs_generator_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ def create_new_component(name)
438438
context "when component with CSS module" do
439439
let(:component_name) { "ComponentWithCSSModule" }
440440
let(:component_pack) { "#{generated_directory}/#{component_name}.js" }
441+
let(:css_module_pack_glob_pattern) { "#{generated_directory}/#{component_name}.module*" }
441442

442443
before do
443444
stub_packer_source_path(component_name: component_name,
@@ -469,6 +470,15 @@ def create_new_component(name)
469470
expect { eval(sanitized_content) }.not_to raise_error
470471
# rubocop:enable Security/Eval
471472
end
473+
474+
it "does not generate a pack for a CSS module file" do
475+
expect(Dir.glob(css_module_pack_glob_pattern)).to be_empty
476+
end
477+
478+
it "only generates the js pack" do
479+
generated_files = Dir.entries(generated_directory).reject { |f| f.start_with?(".") }
480+
expect(generated_files).to eq([File.basename(component_pack)])
481+
end
472482
end
473483

474484
def generated_server_bundle_file_path

0 commit comments

Comments
 (0)