GithubHelp home page GithubHelp logo

Comments (17)

searls avatar searls commented on June 1, 2024

That's no good! I can't tell a ton from the stack trace. Could you share a minimal project that replicates the issue?

from jasmine-rails.

hung-phan avatar hung-phan commented on June 1, 2024

I also run into this problem when developing my project. When running `RAILS_ENV=test bundle exec rake spec:javascript' I run into

RAILS_ENV=test bundle exec rake spec:javascript
Running `"/usr/bin/phantomjs" "/home/colorvisa/.rvm/gems/ruby-2.1.1/gems/jasmine-rails-0.9.1/lib/jasmine_rails/../assets/javascripts/jasmine-runner.js" "/home/colorvisa/workarea/working on/private-profile/tmp/jasmine/runner.html?spec="`
Running: /home/colorvisa/workarea/working on/private-profile/tmp/jasmine/runner.html?spec=
ERROR: ReferenceError: Can't find variable: jsApiReporter
TRACE:
 -> phantomjs://webpage.evaluate(): 4
rake aborted!
Error executing command: "/usr/bin/phantomjs" "/home/colorvisa/.rvm/gems/ruby-2.1.1/gems/jasmine-rails-0.9.1/lib/jasmine_rails/../assets/javascripts/jasmine-runner.js" "/home/colorvisa/workarea/working on/private-profile/tmp/jasmine/runner.html?spec="
/home/colorvisa/.rvm/gems/ruby-2.1.1/gems/jasmine-rails-0.9.1/lib/jasmine_rails/runner.rb:71:in `run_cmd'
/home/colorvisa/.rvm/gems/ruby-2.1.1/gems/jasmine-rails-0.9.1/lib/jasmine_rails/runner.rb:21:in `block in run'
/home/colorvisa/.rvm/gems/ruby-2.1.1/gems/jasmine-rails-0.9.1/lib/jasmine_rails/runner.rb:48:in `override_rails_config'
/home/colorvisa/.rvm/gems/ruby-2.1.1/gems/jasmine-rails-0.9.1/lib/jasmine_rails/runner.rb:9:in `run'
/home/colorvisa/.rvm/gems/ruby-2.1.1/gems/jasmine-rails-0.9.1/lib/tasks/jasmine-rails_tasks.rake:8:in `block (2 levels) in <top (required)>'
/home/colorvisa/.rvm/gems/ruby-2.1.1@global/bin/ruby_executable_hooks:15:in `eval'
/home/colorvisa/.rvm/gems/ruby-2.1.1@global/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => spec:javascript
(See full trace by running task with --trace)

However, when running in normal browser environment I do not get these errors localhost:3000/specs.

from jasmine-rails.

alexcwatt avatar alexcwatt commented on June 1, 2024

I am experiencing the same problem — tests are fine in the browser, but when running the specs from the console, I get this error:

ERROR: ReferenceError: Can't find variable: jQuery
TRACE:
 -> https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js: 5

I stripped down the runner.html file to the following, and still get an error when running it with "/home/acwatt/.phantomjs/1.9.7/x86_64-linux/bin/phantomjs" "/home/acwatt/.rvm/gems/ruby-2.1.0/gems/jasmine-rails-0.10.5/lib/jasmine_rails/../assets/javascripts/jasmine-runner.js" "/home/acwatt/myproject/tmp/jasmine/runner.html?spec="

<!DOCTYPE html>
<html>
  <head>
    <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
    <title>Jasmine Specs</title>

    <link href="./assets/jasmine.css" media="screen" rel="stylesheet" />
<link href="./assets/jasmine-specs.css" media="screen" rel="stylesheet" />

    <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.min.js"></script>

    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
  </head>
</html>

Any ideas? Thanks, and happy new year!

from jasmine-rails.

gfrivolt avatar gfrivolt commented on June 1, 2024

I'm having the same missing jsApiReporter variable issue. The specs pass but at the end the strange error shows up:

Running `"/usr/local/bin/phantomjs" "/home/runner/environet-ui/vendor/bundle/ruby/2.2.0/gems/jasmine-rails-0.10.5/lib/jasmine_rails/../assets/javascripts/jasmine-runner.js" "/home/runner/environet-ui/tmp/jasmine/runner.html?spec="`
Running: /home/runner/environet-ui/tmp/jasmine/runner.html?spec=
Starting...

Finished
-----------------
101 specs, 2 skipped or pending, 0 failures in 0.125s.

ConsoleReporter finished
ERROR: ReferenceError: Can't find variable: jsApiReporter
TRACE:
 -> phantomjs://webpage.evaluate(): 4
ERROR: ReferenceError: Can't find variable: jsApiReporter
TRACE:
 -> phantomjs://webpage.evaluate(): 4
......
...   Lot of  times
.......
ERROR: ReferenceError: Can't find variable: jsApiReporter
TRACE:
 -> phantomjs://webpage.evaluate(): 4
rake aborted!
Error executing command: "/usr/local/bin/phantomjs" "/home/runner/environet-ui/vendor/bundle/ruby/2.2.0/gems/jasmine-rails-0.10.5/lib/jasmine_rails/../assets/javascripts/jasmine-runner.js" "/home/runner/environet-ui/tmp/jasmine/runner.html?spec="
/home/runner/environet-ui/vendor/bundle/ruby/2.2.0/gems/jasmine-rails-0.10.5/lib/jasmine_rails/runner.rb:71:in `run_cmd'
/home/runner/environet-ui/vendor/bundle/ruby/2.2.0/gems/jasmine-rails-0.10.5/lib/jasmine_rails/runner.rb:21:in `block in run'
/home/runner/environet-ui/vendor/bundle/ruby/2.2.0/gems/jasmine-rails-0.10.5/lib/jasmine_rails/runner.rb:48:in `override_rails_config'
/home/runner/environet-ui/vendor/bundle/ruby/2.2.0/gems/jasmine-rails-0.10.5/lib/jasmine_rails/runner.rb:9:in `run'
/home/runner/environet-ui/vendor/bundle/ruby/2.2.0/gems/jasmine-rails-0.10.5/lib/tasks/jasmine-rails_tasks.rake:8:in `block (2 levels) in <top (required)>'
Tasks: TOP => spec:javascript
(See full trace by running task with --trace)

How is it possible that a global jasmine reference like jsApiReporter is missing?

from jasmine-rails.

AntiFish03 avatar AntiFish03 commented on June 1, 2024

@fifigyuri, I had this issue using jasmine 2+, when adding blanket.js. the issue is that jasmine has changed and jasmine is not really global anymore. If you look at this diff getaroom/jasmine-rails@searls:master...master

It might assist you in either finding or resolving the issue. I apologize that I can't be more help at the moment.

** Disclaimer **
Also, I can't guarantee that my fork will work for you... I have made a lot of one off changes to support requirejs and blanket.

from jasmine-rails.

gfrivolt avatar gfrivolt commented on June 1, 2024

Thank you @AntiFish03, I tried to go through it, there's certainly lot of things to learn from the code you gave.

from jasmine-rails.

AntiFish03 avatar AntiFish03 commented on June 1, 2024

@fifigyuri I wish I could give you more but all I remember is that I ran into this issue and was able to fix it, so the problem has a solution.

from jasmine-rails.

gfrivolt avatar gfrivolt commented on June 1, 2024

actually the problem showed up to be with phantomjs, we use now 1.9.7, version 1.9.8 has bugs, and the fixes are only on phantomjs master, no release before 2.0 is supposed to happen.

from jasmine-rails.

toddmazierski avatar toddmazierski commented on June 1, 2024

We were able to work around our Can't find variable: jsApiReporter errors by following @fifigyuri and @jamesottaway's lead, and adding an explicit PhantomJS dependency to our Rails project:

# Gemfile
gem 'phantomjs', '< 1.9.8', '>= 1.9'

Which, in turn, installed:

# Gemfile.lock
phantomjs (1.9.7.1)

Hope that's useful!

from jasmine-rails.

hung-phan avatar hung-phan commented on June 1, 2024

👍

from jasmine-rails.

searls avatar searls commented on June 1, 2024

So I'm a bit in the dark as to what's happening here. Is this an error that only affects people running PhantomJS 2.x and Require.js?

from jasmine-rails.

cherimarie avatar cherimarie commented on June 1, 2024

@searls I'm running phantomjs 1.9.8.0 and jasmine-rails 0.11.0, no require.js, and seeing it. Tried directly requiring phantomjs as @toddmazierski suggested, but that didn't fix it.

from jasmine-rails.

AntiFish03 avatar AntiFish03 commented on June 1, 2024

@cherimarie or @toddmazierski, Are you using Jasmine 1.x or 2.x? I ask because Jasmine changed the boot file for 2.0+

https://github.com/jasmine/jasmine/blob/master/lib/jasmine-core/boot.js

And @searls I am just trying to help here... Least I can do since you gave me a great starting point to work from for what I needed.

from jasmine-rails.

toddmazierski avatar toddmazierski commented on June 1, 2024

@AntiFish03, here's more from our Gemfile.lock:

    jasmine-core (2.3.4)
    jasmine-rails (0.10.8)
      jasmine-core (>= 1.3, < 3.0)
      phantomjs (>= 1.9)
      railties (>= 3.2.0)
      sprockets-rails

Hope this is useful!

from jasmine-rails.

AntiFish03 avatar AntiFish03 commented on June 1, 2024

ok so Jasmine 2.3.4 (latest release) When I get home from work I will try a clean project. I think it has to do with the Jasmine Boot (https://github.com/searls/jasmine-rails/blob/v0.10.8/lib/assets/javascripts/jasmine-boot.js) given that it is drastically different from what Jasmine-Core recommends (https://github.com/jasmine/jasmine/blob/master/lib/jasmine-core/boot.js)

from jasmine-rails.

cherimarie avatar cherimarie commented on June 1, 2024

@AntiFish03

 jasmine-core (2.3.4)
 jasmine-jquery-rails (2.0.3)
 jasmine-rails (0.11.0)
      jasmine-core (>= 1.3, < 3.0)
      phantomjs (>= 1.9)
      railties (>= 3.2.0)
      sprockets-rails

from jasmine-rails.

AntiFish03 avatar AntiFish03 commented on June 1, 2024

@cherimarie @toddmazierski, I can't replicate this with a new project can you give me an example of a spec and JS that is causing this? It looks like the ConsoleReporter is running given

Finished
-----------------
101 specs, 2 skipped or pending, 0 failures in 0.125s.

ConsoleReporter finished
ERROR: ReferenceError: Can't find variable: jsApiReporter

So I wonder if some of your JS is still executing after the test suites finish...

from jasmine-rails.

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.