Giter Club home page Giter Club logo

Comments (12)

jejacks0n avatar jejacks0n commented on August 16, 2024

Teabag doesn't do any of the coffeescript conversion for you and relies on the asset pipeline that Rails provides.. can confirm that you have coffeescript setup in Rails -- eg. "gem 'coffee-rails'" in your Gemfile?

And that you can load a converted coffeescript file as js in the browser? Try loading one of your coffeescript files in by the url (/assets/your_file.js) and see if it serves it.

from teaspoon.

brandonparsons avatar brandonparsons commented on August 16, 2024

Thanks for the quick reply!!

Coffeescript is working just fine in the rest of rails (i.e. for coffeescript files in the standard directories).

Do I have to somehow tell rails to compile coffee files in the test/javascripts directory?

from teaspoon.

jejacks0n avatar jejacks0n commented on August 16, 2024

no, you shouldn't.. is it serving files from that path at all?

from teaspoon.

jejacks0n avatar jejacks0n commented on August 16, 2024

It should be adding /test/javascripts to your asset paths:

https://github.com/modeset/teabag/blob/master/lib/teabag/configuration.rb#L10

which is then added to the asset paths in the engine:

https://github.com/modeset/teabag/blob/master/lib/teabag/engine.rb#L11

Can you confirm this is happening?

from teaspoon.

brandonparsons avatar brandonparsons commented on August 16, 2024

Nope...

localhost:3000/assets/application.js --> works
localhost:3000/assets/test/javascripts/my_test.js --> does not work (there is a test/javascripts/my_test.coffee file)

Something that may lead in the right direction.... The teabag support files are in coffeescript, and seem to be working just fine. It's just the tests that aren't being compiled.... Not sure if that helps?

from teaspoon.

jejacks0n avatar jejacks0n commented on August 16, 2024

Try /assets/my_test.js

from teaspoon.

brandonparsons avatar brandonparsons commented on August 16, 2024

Ugh. I'm so sorry. I had a syntax error in my coffeescript, and it was throwing an error....

from teaspoon.

jejacks0n avatar jejacks0n commented on August 16, 2024

No worries, thanks for the follow up.

from teaspoon.

chikamichi avatar chikamichi commented on August 16, 2024

@jejacks0n I actually have the same kind of issue with .coffee files under spec/javascripts (using Mocha, with expect and chai). Unlike coffee files under app/assets/javascripts, they are not compiled at runtime and, in particular, the #= require directives are not expanded so specs just fail.

If I understood it well by reading the source code, the asset pipeline should be aware of spec/javascripts as a location for compiling, so no explicit setting is required. Do you have an idea about what could be going wrong here?

Thank you!


edit: I saw that it actually generates .js files, but for some reasons, the dependencies are not loaded. When I delete the .js file and run the spec again, it passes. This ends up generating the .js file again, and then the spec fails. This looks like an issue unrelated to teaspoon, but rather involving the asset pipeline (but you may have a hint about it!).

from teaspoon.

brandonparsons avatar brandonparsons commented on August 16, 2024

It turned out that I had a syntax error in my coffeescript. Should work
after that!

On Thu, Jun 20, 2013 at 6:21 PM, Jean-Denis Vauguet <
[email protected]> wrote:

@jejacks0n https://github.com/jejacks0n I actually have the same kind
of issue with .coffee files under spec/javascripts. Unlike coffee files
under app/assets/javascripts, they are not compiled at runtime and, in
particular, the #= require directives are not expanded so specs just fail.

If I understood it well by reading the source code, the asset pipeline
should be aware of spec/javascripts as a location for compiling, so no
explicit setting is required. Do you have an idea about what could be going
wrong here?

Thank you!


Reply to this email directly or view it on GitHubhttps://github.com//issues/75#issuecomment-19792134
.

from teaspoon.

chikamichi avatar chikamichi commented on August 16, 2024

Well, the thing is, it works smoothly when running the website. The broken behavior is specific to running the spec. If I find something, I'll share the insight with you here :)

from teaspoon.

chikamichi avatar chikamichi commented on August 16, 2024

I fixed the issue. It was unrelated to teaspoon, as eventually expected: a setting in my .vimrc was triggering auto-compilation of .coffee edited files. Thank you for your help!

from teaspoon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.