Closed alex-kovshovik closed 7 years ago
I cloned your repo and wasn't able to reproduce this. Is there something missing? Here are the steps I took:
Then I ran the rails server to see the the packs working in dev mode. Then I ran your test command:
[BC]webpacker30-test $ bin/rails test:system
/Users/bcase/Code/OpenSource/Examples/webpacker30-test/db/schema.rb doesn't exist yet. Run `rails db:migrate` to create it, then try again. If you do not intend to use a database, you should instead alter /Users/bcase/Code/OpenSource/Examples/webpacker30-test/config/application.rb to limit the frameworks that will be loaded.
Run options: --seed 39679
# Running:
Puma starting in single mode...
* Version 3.10.0 (ruby 2.3.3-p222), codename: Russell's Teapot
* Min threads: 0, max threads: 1
* Environment: test
* Listening on tcp://0.0.0.0:50203
Use Ctrl-C to stop
.
Finished in 5.092019s, 0.1964 runs/s, 0.1964 assertions/s.
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
Am I missing something?
Hm, this is strange: something must have been cached in my working copy. When I cloned my own repo into a different location - it worked too. Sorry for the false alarm.
I then created another brand new Rails app and it worked again. Here are the steps:
rails new webpacker-test --webpack
app/javascript/application.sass
app/javascript/packs/application.js
javascript_pack_tag
and stylesheet_pack_tag
to the layout templatebin/rails s
to make sure styles from sass file are loadedIn case this helps somebody else: in my working copy with the problem I had public/packs
and public/packs-test
directories. After I've deleted them and restarted system tests - it worked. Must have been some local dev caching issue.
To get webpacker to re-build everything:
rm -rf public/packs
rm -rf public/packs-test
I ran into a similar issue. My assets were not fully compiling when running tests giving me the same error as @alex-kovshovik . Then I ran RAILS_ENV=test bin/webpack to force compiling my assets under test and low and behold I didn't have the correct bindings for nodesass for my version of osx. Once I fixed that, all my assets compiled correctly. If there is an issue, it might be that when the compilation of the assets under TEST fails, it doesn't stop running the tests which is confusing. Thoughts?
Thanks, @jonesmac! npm rebuild node-sass
fixed it for me
Brand new Rails 5.1.3 app with just this problem repeated: https://github.com/alex-kovshovik/webpacker30-test
I created the
application.sass
file underapp/javascript/sass
and then added the following to myapp/javascript/packs/application.js
:This works great in development: SASS file is compiled into CSS and is put into
public/packs
.When I try to run a Rails system tests (
bin/rails test:system
) - it fails with the following error:I tried to find solutions online and reviewed other webpacker issues: couldn't figure it out. Please help, if that's OK :)