react-rails icon indicating copy to clipboard operation
react-rails copied to clipboard

Jest tests not allowed in components directory.

Open radglob opened this issue 5 years ago • 0 comments

Help us help you! Have you looked for similar issues? Do you have reproduction steps? Contributing Guide I recently added react-rails to an existing project, and production builds are failing if there are Jest test files in the /components directory.

Steps to reproduce

With the example structure: app/javascript/components: component.jsx tests: component.test.jsx

where component.test.jsx imports react-test-renderer.

Run:

export NODE_ENV=production RAILS_ENV=production
bundle install --deployment --quiet --without test development && yarn install --silent
bundle exec rails assets:precompile --silent

I get a ModuleNotFoundError in component.test.jsx because it cannot find react-test-renderer. This makes sense to me because react-test-renderer is in my devDependencies and should not have been installed. However, I have other components and related test files outside of the components directory that do not get this failure.

Removing the test file from components fixes the error. This seems easily resolved if I was able to set an ignore pattern for react-rails to ignore test files.

Happy to provide more detail here.

(Guidelines for creating a bug report are available here)

Expected behavior

Tell us what should happen

Actual behavior

Tell us what happens instead

System configuration

Sprockets or Webpacker version: Webpacker 4.3.0 React-Rails version: 2.6.1 Rect_UJS version: 2.6.0 Rails version: 5.2.1 Ruby version: 2.5.7


(Describe your issue here)

radglob avatar Dec 02 '20 19:12 radglob