jejacks0n / teaspoon

Teaspoon: Javascript test runner for Rails. Use Selenium, BrowserStack, or PhantomJS.
1.43k stars 243 forks source link

Remove wildcard for teaspoon/*.js from precompile paths #536

Closed md5 closed 6 years ago

md5 commented 6 years ago

This PR removes teaspoon/*.js from the Sprockets precompile path. This was causing assets:precompile to fail in the absence of the coffee-rails gem on Sprockets 3+. As far as I can tell, all of these files are explicitly compiled into *.js files by the teaspoon:*:build Rake tasks and do not need to be used in the asset pipeline.

Fixes #405

jejacks0n commented 6 years ago

You can confirm this works with older rails projects? One of the big challenges in teaspoon is that sprockets can't decide on how to do things, so it's a constant effort to keep it working. I really appreciate you guys working to sort it out -- watching that stuff as I'm running errands is the best part of open source. Many thanks and 👍 .

md5 commented 6 years ago

@jejacks0n do you have a support matrix?

md5 commented 6 years ago

Rails 4.2.10 appears to work: https://github.com/md5/teaspooon-rails-4.2-without-coffee

md5 commented 6 years ago

I also tested Rail 3.2.22.5 with the same results.

Here's a list of Javascript and Coffeescript files in directories called teaspoon in the project:

$ find -E !(spec) -regex '.*/teaspoon/[^/]*\.(js|coffee)'
app/assets/javascripts/teaspoon/error.coffee
app/assets/javascripts/teaspoon/fixture.coffee
app/assets/javascripts/teaspoon/teaspoon.coffee
app/assets/javascripts/teaspoon/hook.coffee
app/assets/javascripts/teaspoon/suite.coffee
app/assets/javascripts/teaspoon/spec.coffee
app/assets/javascripts/teaspoon/utility.coffee
app/assets/javascripts/teaspoon/runner.coffee
teaspoon-jasmine/lib/teaspoon/jasmine/assets/teaspoon/jasmine1.coffee
teaspoon-jasmine/lib/teaspoon/jasmine/assets/teaspoon/jasmine2.coffee
teaspoon-mocha/lib/teaspoon/mocha/assets/teaspoon/mocha.coffee
teaspoon-qunit/lib/teaspoon/qunit/assets/teaspoon/qunit.coffee

Are any of these meant to be loaded directly by an application with javascript_include_tag?

My understanding is that a file like jasmine1.coffee gets compiled by bundle exec rake teaspoon:jasmine:build into teaspoon-jasmine/lib/teaspoon/jasmine/assets/teaspoon-jasmine1.js, the contents of which are then commited back to this repository. These "manifest" *.coffee files each include their own code along with code from app/assets/javascripts/teaspoon. From there, it is something like javascript_include_tag 'teaspoon-jasmine1' that gets injected into the test harness page.

Is my understanding accurate? If so, I think this commit is safe. If anyone was relying on teaspoon/*.js being in the precompile path, they'll have to add that back in their application themselves, but that seems unlikely.

md5 commented 6 years ago

@jejacks0n Any thoughts on this PR?

aharpervc commented 6 years ago

I just hit this while upgrading from rails 4.2 to rails 5.2. What is the hold up with getting this merged? Is there something I can do to help?

aharpervc commented 6 years ago

jejacks0n merged commit 4e9c4de into jejacks0n:master 2 hours ago

Wow, fast service 😄! I built teaspoon & teaspoon-mocha locally and confirmed that I don't get the coffee script error any more. Can these gems versions be bumped & pushed to rubygems?