-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jasmine 2.0 support #161
Comments
Thanks for the report. I can confirm that guard-jasmine seems to be broken with Jasmine 2. It looks like the interface to the reporter API has been changed. I need to investigate this to get an idea what the changes are and how they impact the current design, but I do not have time this and next week. |
So I've been looking at this. Unfortunately, the jasmineDone new function doesn't receive the results. However, jasmine/src/core/Env.js:165 currently receives a resultCallback with the results. Unfortunately jasmine 2.0 still doesn't hook this callback to reporter.jasmineDone. Seems like making guard-jasmine working with jasmine 2.0.0 will be a little hard meaning we'll have to collect results spec by spec or suite by suite. Disclaimer: this is the first time I look at any of this so I can be completely off on this matter |
Wow, thanks for sharing your findings.
That's an easy one ;)
The only thing we need from the end result is the failed count, because we already collect the results on a suite basis. Getting the results failed count was just convenient, but we can get the same information from the already collected suite result or even just increment a failed spec counter, that'll be more easier since suite results are nested. |
I'm not incredibly familiar with how jasmine works under the hood, but I'd really like to use v2 in something I'm building. Is there anything I can do to help this along? |
Me too... I'd love to have this working, and I'd be pleased to work on it. |
My current understanding from @hugocorbucci findings is that the Jasmine Reporter API has changed, see his comment above. This means we need to update our Reporter implementation and ensure we can somehow collect the same information over the new API as we were able in the old API. I'd not bother with being backward compatible, we can just increase the Guard::Jasmine version number to 2.0 and we're fine ;) |
On Mar 29, 2014, at 19:39 , Michael Kessler [email protected] wrote:
Since the messages look to be totally different, how about having a proxy object that responds to both and delegates either to the old or the new implementation? My gut says that it would be easier to test and build, and have the added advantage of being backwards compatible... |
I'm just telling this to keep the contribution barrier low, since I don't have plans to work on this ;) I prefer having a simple solution over not having an advanced one. But I wouldn't disagree if the pull request comes with a good approach to maintain backwards compatibility. |
I've been meaning and trying to write that change for a while now. |
On Apr 3, 2014, at 00:21 , Hugo Corbucci [email protected] wrote:
Same here — if I can block out some time later on in April I’ll help out. |
Any progress on this? Also to make your life easier on jasminerice I have forked it and made it support Jasmine 2.0. https://github.com/nmccready/jasminerice . Jasmine-JQuery on there is also backwards compatible with older versions of JQuery . https://github.com/nmccready/jasmine-jquery |
Jasmine appears to have a new API for registering custom reporters and even has a ConsoleReporter implementation of it's own. Does it make sense to just use that directly? |
Ok just reviewing this some more. It seems to me that the ConsoleReporter is an unnecessary level of abstraction here as it is just formatting console.log output which is being fed back into the It seems to me that we could just feed the results directly to to a |
Ok so one last thought on how to do this. It seems the |
Any updates? |
@nmccready I'm working on support for Jasmine 2. I'm using the approach you'd suggested by using the Jasmine 2 API vs scraping the console like it does now. As part of that the JSON that is returned is different though, making the change set to the runner a bit more complex. I hope to have a version ready in the next few days for testing, and will report back when it's ready. |
Excellent, no offense I hope I beat you with my port of our rails front end application to node.js/gulp and thus no need for this any more. ;) However if you need help let me know. |
CURSES!! Another one is lost to the clutches of node... Glad you've got something working though. I'd also evaluated that solution as well, but since I'm already using Guard quite a bit, it made sense for me to fixup the runner so I could continue using it. I also couldn't get the growl integration working well with it, which Guard has excellent support for. |
I've just checked in a new runner that supports Jasmine 2. 392aa6d I'll keep it on the jasmine-2 branch for the time being until it's got a bit of testing, then I'll move it to master and we'll cut a gem eventually. If anyone who's commented on this can help test it out, that'd be great. |
I just tried your commit. Gemfile:
Guardfile:
Error:
|
I just tried too. and got: 17:06:11 - ERROR - An error occurred: Javascript error encountered on On Fri, May 23, 2014 at 4:18 PM, nmccready [email protected] wrote:
|
Thanks for testing the branch! Looks like I made a bone-headed mistake and missed a few stray references to an old class name. The strange thing is that all the specs still passed and my project was also able to run it’s jasmine specs fine as well. I wonder if perhaps my version of phantomjs (1.9.7) is somehow more forgiving? Unfortunately the repo has just moved from netzpirat/guard-jasmine to guard/guard-jasmine and I’ve lost commit ability somewhere along the line. While that’s sorted, I’ve just pushed up a fix to my repo at: https://github.com/nathanstitt/guard-jasmine/tree/jasmine-2 If you'd like, please give that copy a spin. Thanks again for taking the time to test and reporting the bug. |
@nathanstitt not sure if this will help you any but I just got jasmine2 working with gulp-jasmine . See here: https://github.com/nmccready/gulp-jasmine/tree/jasmine-npm |
After trying your latest I got:
|
@nmccready Thanks for your assistance debugging this. That error is sent by the page.onError handler when it catches an exception. It also sends back a stack trace, which it looks like I'm failing to output. I've just pushed up a change to log that, so hopefully that'll let us pinpoint what's going wrong. If you could, can you let me know what version of phantomjs you're running? You should be able to see it by running: Like I said, I've got 1.9.7 and am not receiving any errors. I suspect it's either that or something about your specs is making the script behave badly. Thanks again! |
Yes same version 1.9.7 |
Would jasminerice bork it? |
No luck with testing jasminerice I'm afraid. I created a new rails project and added:
to the Gemfile, and:
to the routes. I then ran
I fired up guard and the specs failed since I hadn't created the assets they were requiring but I got error messages back to that effect. I then created the assets and the test specs passed successfully. My example_spec.js.coffee file is:
Note, I added a spec to test out failing json parsing and it was reported as it should be. In an effort to gather more data, I've just added a "debug" flag to guard-jasmine. My Guardfile above has an example of it. If you could be so kind: please set Thanks so much |
Ok I'll try it out sometime this weekend thanks. |
Thanks! just in case it comes in handy, I've pushed my skeleton rails app that I tested with to: https://github.com/nathanstitt/guard-jasmine-rails-test I await your testing. |
Btw I got everything working on gulp except for phhantomjs w/ jasmine or any spec framework fort that matter. Apparently that hole is still void. https://github.com/mrhooray/gulp-mocha-phantomjs/issues/8 |
@nathanstitt how do I set Something like this with an opts object? vincentchu/guard-flopbox#1 |
I modified your guard-jasmine-rails-test app with the correct configurations (which I will PR to u). Anyways I got this error:
|
Yeah, please link or send a PR to your copy of the As for setting the Your Guardfile's jasmine block probably looks something like this:
You can set options by modifying to be:
this will set debug to be true, and specify a custom path to phantom_js. |
I set the debug to true on my own app with a is Rails 3.2.17 , and I do not get nearly the amount of logging that you get on your app. |
Any news? |
Heya, I was waiting for the output from the :debug option. After the :debug options is set, guard-jasmin should output the JSON that it receives from the test runner. The length of the reply will be highly dependent on how many specs are are ran and what errors are encountered. It seems to me like your specs are having an error that isn't getting reported correctly. I'm curious if the JSON is correctly formatted or if it's mangled somehow by the errors that were encounter. Ideally it will contain a stack trace that will allow us to pinpoint the error. I've also just pushed up an updated version of the Thanks again |
@nmccready Have you been able to confirm if the latest changes are working for you? I'm considering merging into master but don't want to if it's still broken for you. Thanks for your efforts thus far! |
Sorry no luck, let me give it a go again. The last week and half I have been creating a branch of our front-end environment completely ported to gulpjs which is almost done. 100% unit test passing and coverage working there with no problems via karma and jasmine. |
Here is a not so great kludge if you need a Jasmine 2.0 autorunner today:
|
Are there any plans to release the |
Hi @jscheid Right now, if a test suite is disabled, our test runner isn't notified about the start of the suite, but it is notified when the suite ends. This mismatch causes it to blow up at the end of the run. I've been unable to workaround the bug. It's been fixed in the Jasmine source at jasmine/jasmine#573, but they haven't cut a new release yet. Once they do, then I can adjust the gemspec to require jasmine version 2.0.3 (or whatever). The bug only affects disabled suites. Disabling individual specs works fine. Disabling suites probably don't happen all that often, perhaps it would be better to just release as is? Assuming you've tested the branch and it works well for you, is it better to forgo being able to disable suites? |
Hi @nathanstitt, thanks for your quick reply! All makes sense, and there's no huge rush, it's just good to know that it's still on the table. To be honest I haven't tested it, I took @nuc-gr 's word for it. I'm going to give it a whirl tomorrow to make sure. And no, we don't have disabled suites I don't think, but I don't feel it's my place to make that call... I guess it's fine to wait until Jasmine got their stuff sorted out. |
I've been using it for quite a while too. No serious issues so far. |
Hi @nathanstitt, I just noticed that the commit referenced by jasmine/jasmine#573 appears to have been merged into Jasmine 2.0.2 (current is 2.0.3 released Sep 19.) Am I missing something?
|
Hm, this is interesting/weird. The releases are tagged, but the latest release on ruby gems is 2.0.2 https://rubygems.org/gems/jasmine-core I've fired off an issue to ask the Jasmine project about it. jasmine/jasmine#701 |
FWIW I was looking at the jasmine gem, not jasmine-core. https://rubygems.org/gems/jasmine -- that was released Sep 19. |
Yeah, but the jasmine gem pulls the Javascript (which is what we need) from jasmine-core. The gem for jasmine-core hasn't been released since 2.0.2. |
Ah, right, that makes more sense. |
@nathanstitt it looks like this PR has already been released:
|
Hi again, I've tried using the
|
Sorry, disregard my previous comment. I've tried again from scratch today and everything is working fine, not sure what I did wrong yesterday. |
Hi @jscheid I actually had this open replying to you. I'm guessing what was going on is that the internal server had gotten jammed up somehow and wasn't responding to the request to run the suites. The jasmine project replied to the ticket I'd opened. You are correct, the 2.0.2 release does have the fix included. The git tags were for npm packages. My test app continues to fail on disabled suites though. I'm hoping to have some time later in the week to dig into it further to figure out what's going on with it. |
At long last, I've moved support into master and am going to be cutting a beta gem in the next few days. I'm not sure what was going on with my testing setup, but it refused to load the proper Jasmine test runner. Removing Jasminerice and using Jasmine 2's built-in asset pipeline support resolved it for me. I'm going to close this (very lengthy) issue for now and encourage anyone having further issues to re-open a new issue. Thanks for everyone's patience! |
I'm using guard-jasmine with the jasmine gem and
server: :jasmine_gem
in Rails 4.If I browse to the Jasmine server URL, the specs run as expected.
Inside Guard, however, it appears guard-jasmine is not properly parsing the output of the jasmine_gem server:
I'm guessing the format of the output from the jasmine gem changed in 2.0, and guard-jasmine is not recognizing it as valid output? Because the specs are clearly running, but guard-jasmine isn't understanding what it gets back.
The text was updated successfully, but these errors were encountered: