Webpacker: Capybara and webpacker problem

Created on 28 Apr 2017  路  5Comments  路  Source: rails/webpacker

Hi! I just tried to use fresh 5.1 rails app with capybara and got error:

Failure/Error: = javascript_pack_tag    'application'

     ActionView::Template::Error:
       Can't find application.js in /****/public/packs/manifest-test.json. Is webpack still compiling?
...
...
# --- Caused by: ---
     # Webpacker::FileLoader::NotFoundError:
     #   Can't find application.js in /***/public/packs/manifest-test.json. Is webpack still compiling?
     #   /***/bundler/gems/webpacker-56bd687798b6/lib/webpacker/manifest.rb:21:in `lookup'

webpack dev server is running.

It looks like rails cant find application.js in test environment, but how to find the solution for this problem?

Development env is working ok.

Any ideas?

Most helpful comment

RAILS_ENV=test ./bin/rails webpacker:compile

should be executed before running tests

All 5 comments

RAILS_ENV=test ./bin/rails webpacker:compile

should be executed before running tests

@mfazekas Thank You! That helped. Do this command interfere with development server?

Nope it doesn't since it's scoped by environment and uses different manifest 馃憤

@gauravtiwari Thanks!

I wonder if it would be nicer if we had something that could be dropped into RSpec's rails_helper.rb
eg. require 'webpacker/rspec'

//edit just come across PR #360
Awesome

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ijdickinson picture ijdickinson  路  3Comments

itay-grudev picture itay-grudev  路  3Comments

naps62 picture naps62  路  3Comments

suhomlineugene picture suhomlineugene  路  3Comments

eriknygren picture eriknygren  路  3Comments