Open terryyin opened 8 years ago
Could you create an example project that demonstrates the problem? Perhaps consider pushing a fork of https://github.com/searls/jasmine-rails-exploratory-tests that reproduces the issue?
I'm getting the same or similar error -- though I'm on ARM, not x86. How do I run the tests on the exploratory-tests repository? bundle exec rake spec:javascript
gave:
The path
/home/warren/sites/jasmine-rails
does not exist.
I can't make much of it, but here's my log when i do it with debug=true:
https://gist.github.com/jywarren/c83f582a2c2387cdbfc6925722398881
Same problem on my machine (linux, phantomjs 2.1.1). I think CircleCi experiences same problem
https://gist.github.com/mtomov/b5469ad032bc09cdb833d11fb1751c02
+1 Same problem, having issues on Mac and Linux. Any updates on this?
Sorry should have read from the command line first.
@mtomov: Circle uses 1.9.8 by default which works.
This is a pretty serious issue though, I too have jasmine-rails
breaking with phantomjs
2.1.1 (haven't tested other 2.x releases). Platforms: Mac & Linux (Debian).
Will be downgrading to 1.9.8 for now.
@zacblazic you can control the version of phantomjs that's used by locking to a specific version of the phantomjs gem, right?
Can anyone on this thread reproduce the issue with an example project? I just spent 30 minutes locally trying to and I couldn't, using PhantomJS 2.1.1 installed via homebrew.
+1'ing this issue.
On Friday, with PhantomJS 2.1.1 installed via Homebrew and jasmine-rails 0.14.1, my test suite ran without error. Come Monday morning, I start experiencing the PhantomJS crashes reported by @terryyin and others.
My step-by-step to get to a working test suite:
brew uninstall phantomjs
brew tap homebrew/versions
brew install phantomjs198
Gemfile
: gem 'phantomjs', '~> 1.9'
and gem 'jasmine-rails', '~> 0.14.1'
bundle install
rake spec:javascript
and :clap:.The above will use a system-level PhantomJS. I didn't try these steps using a version of PhantomJS installed by the gem to ~/.phantomjs
so YMMV.
Hey @jgarber623 are you able to provide a failing example project? I can't even get to that point
@searls The app and hardware I experienced the issue on are private/employer-managed, so I can't share that code directly. I can see about replicating the problem on other hardware, but that might not necessarily address how the problem (for me, anyway) started over the course of a weekend when my computer sat unused. 🤔
It's a very curious problem, for sure.
(And thanks for jasmine-rails, by the way! 😁 )
@searls Did a bit more digging in on this one and found the actual problem in my code.
In a particular spec file, I had code similar to:
describe('some bit of functionality', function() {
it('does a thing.', function() {
//
});
});
That empty assertion callback was causing PhantomJS 2.1.1 to crash. It did not crash PhantomJS 1.9.8. The takeaway here is that empty describe
callback functions appear to be okay (for now), but empty it
callback functions should be avoided.
describe('some bit of functionality', function() {
// this is okay
});
describe('some bit of functionality', function() {
it('does a thing.', function() {
// you're in for bad times
});
});
I'm not sure if this will solve anyone else's problems, but it was the root problem in my codebase.
(Hat tip to @ju-Skinner for his help debugging this one.)
@jgarber623 what if the it
contains statements other than expect
assertions? It only fails when there are no statements in the function?
@searls Ran a couple quick experiments:
describe('some piece of functionality', function() {
it('crashes PhantomJS.', function() {});
});
describe('some piece of functionality', function() {
it('crashes PhantomJS.', function() {
//
});
});
describe('some piece of functionality', function() {
it('crashes PhantomJS.', function() {
'use strict';
});
});
describe('some piece of functionality', function() {
it('crashes PhantomJS.', function() {
var foo = 'bar';
});
});
describe('some piece of functionality', function() {
it('is listed as a skipped or pending spec and does not crash PhantomJS.');
});
The top four examples all crash PhantomJS. The last one does not.
I don't have any empty / pending / etc tests in my test suite, but phantomjs still crashes as described.
I'm on PhantomJS 2.1.1 and jasmine-rails
0.14.1. I was getting the "PhantomJS has crashed" error too with this simple test case:
describe('test', function(){
it('test', function() {
expect(null).toEqual(null)
})
})
However the issue turned out not to be related to the test case itself but some compatibility error in my javascript application code. To see if you have any errors open tmp/jasmine/runner.html
file that is generated after every test run and inspect the web console. Once resolved my test runner ran successfully.
In my case the issue was resolved by simply adding the missing ()
to the end of a method call (it was coffeescript).
- expect( @meter.poll ).toBeFalsy
+ expect( @meter.poll ).toBeFalsy()
I'm pretty sure that this #194 fixed the issue for me. CircleCI also passes with that. Thanks a lot!
After reading lib/assets/javascripts/jasmine-runner.js, I found the problem might partially be fixed by #194, but it also needs the pull request https://github.com/searls/jasmine-rails/pull/212 for a couple of bugs.
Got problem like
Downgrade PhantomJS to 1.9.8 solved the problem.