Skip to content
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

PhantomJS 2.0 Landed #175

Closed
metaskills opened this issue Feb 2, 2015 · 43 comments
Closed

PhantomJS 2.0 Landed #175

metaskills opened this issue Feb 2, 2015 · 43 comments

Comments

@metaskills
Copy link
Collaborator

Just gonna drop this here:

https://github.com/ariya/phantomjs/wiki/PhantomJS-2

@darky
Copy link

darky commented Feb 5, 2015

I try to replace phantomjs binary from 1.x to 2.x
And mocha-phantomjs not working with it now.
Cli process simply freezes on infinite time.

@nathanboktae
Copy link
Owner

I downloaded the mac OS X binary and it would just die.

Yes they expliclity removed coffeescript so it won't work at all as is. We either need to just use JavaScript or compile to JavaScript as part of a distribution - I prefer the former.

Some other things to consider for a major release:

@metaskills
Copy link
Collaborator Author

OS X binary and it would just die

Same here.

just use JavaScript

That's cool with me.

@metaskills
Copy link
Collaborator Author

FYI, known issue for Mac download. I found this on their issues and am downloading it now.

https://github.com/eugene1g/phantomjs/releases

@nathanboktae
Copy link
Owner

Yup I got that too and ran our tests and found a bug and filed it already - ariya/phantomjs#12973. Could be some more too as there were about 5-7 failing tests. 2.1 is already being prepared.

@nathanboktae
Copy link
Owner

I want to talk more about splitting out the console and core parts here. For end users it doesn't matter, but it matters a lot for integrators, namely build plugin authors. Pinging all the ones I could find:

Integrators: would you be interested in moving over to a mocha-phantomjs-core module? this would save you a process fork, but also, we could revisit how the dependency to phantomjs is managed - I would imagine this core module to not declare it's dependency to phantomjs in npm (it's not a Node.js module, it's phantomjs, but there's no ppm or phantomjs package manager, so we piggyback on npm). So modules that depend on the core get to decide how it finds phantomjs - direct dependecy, peer, maybe consumed from some external config, whatever. I would imagine the CLI module, mocha-phantomjs to have a direct dependency on phantomjs (peer dependencies are a pain).

Thoughts?

@bithavoc
Copy link

👍

@mrhooray
Copy link

mrhooray commented Apr 6, 2015

thanks @nathanboktae for taking the initiative

agree that cli/ghoul and grunt/gulp plugins are just different interfaces/frontends of core library. for example the gulp plugin only depends on lib/mocha-phantomjs.coffee

using phantomjs as peer dependency seems to be a reasonable compromise of many cases/concerns

@hatched
Copy link

hatched commented Apr 7, 2015

Is there a timeline or task list for mocha-phantomjs to support phantomjs 2.0?

@jokeyrhyme
Copy link

Would it be possible for this core to support driving multiple versions of PhantomJS?

I actually find it useful that PhantomJS 1.9 is missing a few web platform APIs, so it would be terrific if I could run tests against both PhantomJS 1.9 and 2.x (and 3.x, etc).

@rjharmon
Copy link

I found that by transpiling the .coffee script to JS, and adjusting the launcher to use it, PhantomJS 2 runs my test suite without difficulty. 1.9 also works fine with that change. I'd suggest adjusting the build to use this technique short-term to fix the compatibility problem.

@nathanboktae
Copy link
Owner

Well a) we have no build as mocha-phantomjs.coffee is directly consumed b) we have supported phantomjs lib/phantomjs ... style execution that will break. Its a good time to do a major version to planning and executing that well is important.

@rjharmon
Copy link

That sounds fine - I'm a fan of good planning too. Meanwhile, it's borked :( ... Any way to include a .js version and probe phantomjs -v from the launcher? I know it's just a band-aid, but it's a band-aid with a purpose: not to replace planning for major version-bump, just to enable compatibility in short-term.

PJS2 users can always choose to use the .js version if they want direct phantomjs lib/phantomjs ... style. Their alternative to having a centrally-provided band-aid, is to hack their installation the way I described (which is its own type of bandaid, I admit).

Your call.

@nathanboktae
Copy link
Owner

Meanwhile, it's borked :(

What is? From your previous comment, sounds like you're fine.

I found that by transpiling the .coffee script to JS, and adjusting the launcher to use it, PhantomJS 2 runs my test suite without difficulty.

I had done this too, but a lot of tests were failing.

@nathanboktae
Copy link
Owner

I'd also like to remove the mochaPhantomJS global. I think we can listen on on onResourceRecieved event and monkey-patch mocha, removing the need for everyone to remember to do:

if (window.mochaPhantomJS) {
  mochaPhantomJS.run()
} else {
  mocha.run()
}

@SirZach
Copy link

SirZach commented May 18, 2015

subscribing. i need phantomjs v2 for the performance api

@nathanboktae
Copy link
Owner

I started work on this in the v4 branch. It's not pointing at phantomjs2 yet.

@mislav
Copy link

mislav commented Jun 15, 2015

For my purposes, I've created a shim executable for phantomjs that detects if CoffeeScript files are being passed to PhantomJS 2.0 and transparently converts them to JS before they reach actual PhantomJS:

#!/bin/bash
set -e
phantomjs="$(which phantomjs)"

coffee-convert() {
  local file="${1?}"
  local dest="${file%.coffee}.js"
  [ "$dest" -nt "$file" ] || coffee -c "$file"
  echo "$dest"
}

if [[ $("$phantomjs" -v) != 1.* ]]; then
  args=()
  for arg; do
    if [[ $arg == *.coffee ]]; then
      arg="$(coffee-convert "$arg")"
    fi
    args[${#args[@]}]="$arg"
  done
  set -- "${args[@]}"
fi

exec "$phantomjs" "$@"

Use it like:

$ mocha-phantomjs --path ./my/phantomjs-shim

@nathanboktae
Copy link
Owner

Awesome that'll be great for people migrating or people wanting to keep writing tests in CoffeeScript.

@nathanboktae
Copy link
Owner

I have published 4.0.0-beta1 out now that uses mocha-phantomjs-core and phantomjs2. The biggest blocker is there are no official linux packages out for phantomjs2, so install fails on linux. If any linux users want to test this, I'd either use mocha-phantomjs-core directly or install it ignoring errors, if possible, then use the -p option to point it at your binary or have it in your path.

I need to update the readme in the v4 branch, but the breaking changes off the top of my head:

  • uses mocha-phantomjs-core now so mocha-phantomjs.coffee is totally gone. build plugin users should use that package directly and avoid an unnessecary process invocation, and have full control over what phantomjs they use and the options going into it.
  • mochaPhantomJS global is gone. Environment variables are on mocha.env and simply calling mocha.run() works since mocha-phantomjs-core is now monkey-patching mocha when it's loaded. This also simplifies the loading detection logic.
  • Errors now go to stderr not stdout.

Issues:

@mislav
Copy link

mislav commented Jul 5, 2015

I have published 4.0.0-beta1 out now that uses mocha-phantomjs-core

So what functionality does this project now add on top of mocha-phantomjs-core?

@nathanboktae
Copy link
Owner

The CLI. mocha-phantomjs-core is just phantomjs code. In fact I could make python and Ruby packages out of it for those developers, as there is no node.js code there.

@nathanboktae
Copy link
Owner

I unplublished 4.0.0-beta1 due to issues with phantomjs2 not working, which is a bad fork of phantomjs which properly has not gone to phantomjs 2 yet because there are no official binaries. (see Medium/phantomjs#288 and #192).

Anyone who was using 4.0.0-beta1 can use the git tag 4.0.0-beta1 or branch v4 (recommended). If you really want phantoms2, you can use that and put phantomjs in your path, use the -p flag, or use mocha-phantomjs-core and call phantomjs directly however you wish.

@jonnor
Copy link

jonnor commented Sep 21, 2015

Seems v4 has been merged to master now

@nathanboktae
Copy link
Owner

Yes, 4.0.0 is out but it is not on phantomjs2 so I didn't close this. After 9 months there's still resolution for the various linux distro binaries, and the npm bug where it does a phantomjs peerDependency of ^1.9.7-15 even though it specifies 1.9.1-1.9.7-15 was getting to be way to painful.

@mwoc
Copy link

mwoc commented Jan 25, 2016

Medium/phantomjs#288
Phantomjs 2.1 is now live, so hopefully soon offered by the phantomjs npm package too

@nathanboktae
Copy link
Owner

Oh that's nice.

I am actually planning on moving away from depending on the npm package phantomjs due to issues like these, and I am working on support for slimerjs now and it's basically working. I want to switch to a BYOB Bring-your-own-binary style full on that mocha-phantomjs-core uses (You have been able to use phantomjs 2.0 with mocha-phantomjs-core for months now).

astorije added a commit to astorije/mocha-phantomjs that referenced this issue Apr 5, 2016
The current version of PhantomJS is [having issues](Medium/phantomjs#522) with Bitbucket, which serves the archive for the main executable.

Without attempting a major version bump (already discussed and apparently stagnating in nathanboktae#175), this bumps from 1.9.7-15 to 1.9.20 as the goal is to prevent all CI tools to fail on projects using `mocha-phantomjs`.
@mmwtsn
Copy link

mmwtsn commented Apr 25, 2016

PhantomJS v2.1.7 is out now. Any updates here?

@jdcataldo
Copy link

Support was added in v3.0 jdcataldo/grunt-mocha-phantomjs@63b7ff3

@Pomax
Copy link

Pomax commented Jul 15, 2016

just ran into the SyntaxError: Parse error error (no information on what goes wrong, running in the browser shows zero console errors), is mocha-phantomjs ever updating to 2.x? Especially after a year and a half of "maybe"? =)

@karlbright
Copy link

Hi Mike, most likely no. This project was more an experiment in how it
could work together. Nowadays testing like this is handled by other
libraries in a much cleaner way. Karma is a good example of this and will
run mocha tests with phantomjs, and other browsers, with just some simple
configuration.
On Sat, 16 Jul 2016 at 5:23 AM, Mike Kamermans notifications@github.com
wrote:

just ran into the SyntaxError: Parse error error (no information on what
goes wrong, running in the browser shows zero console errors), is
mocha-phantomjs ever updating to 2.x? Especially after a year and a half of
"maybe"? =)


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#175 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABQCnlUuCqnK9WkhC4Vv4BCQZgTuJb2ks5qV_pYgaJpZM4DaVuo
.

@nathanboktae
Copy link
Owner

This project was more an experiment in how it
could work together.

Don't speak on behalfof this project if your not a contributor, because that is not true at all.

mocha-phantomjs-core has been supporting phantomjs 2 for a year now and sliders as of recently. The gulp and grunt plugins got switched over too.

Long term plans are to incorporate the client functionality into core which will then eclipse this project.

mocha-phantomjs is simpler to setup than karma and gives you full control over the test runner HTML. But if you want to test other browsers beyond Firefox and phantomjs, go with Karma.

@karlbright
Copy link

Complete apologies. I had a similar repo with the same name at one point
and got completely confused while looking at this from my phone. Sorry
about that @nathanboktae. That's completely my bad.
On Sun, 17 Jul 2016 at 9:43 AM, Nathan Black notifications@github.com
wrote:

This project was more an experiment in how it
could work together.

Don't speak on behalfof this project if your not a contributor, because
that is not true at all.

mocha-phantomjs-core has been supporting phantomjs 2 for a year now and
sliders as of recently. The gulp and grunt plugins got switched over too.

Long term plans are to incorporate the client functionality into core
which will then eclipse this project.

mocha-phantomjs is simpler to setup than karma and gives you full control
over the test runner HTML. But if you want to test other browsers beyond
Firefox and phantomjs, go with Karma.


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#175 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABQCqYXg7Iut0YBD1Je9ZAV6TwDSpfwks5qWYirgaJpZM4DaVuo
.

@nathanboktae
Copy link
Owner

Ah ok thanks for the explanation

@Pomax
Copy link

Pomax commented Jul 18, 2016

@nathanboktae does that mean this issue doesn't need to stay open anymore?

As for my particular usecase, one of our files used ES6 syntax functions, i.e.:

...
  render() { // should have been "render: function() {" for phantom
    ...
  },
...

but mocha-phantom was only able to state the SyntaxError, not in which file it found it, or the line of code that triggered it; If that's a fixable thing that's probably worth fixing.

@nathanboktae
Copy link
Owner

If that's a fixable thing that's probably worth fixing.

It's not fixable. PhantomJS is based on QT3 for 1.x, and QT5 for 2.x and neither supports ES6. The JavaScriptCore, the JavaScript runtime that phantomjs uses has to be upgraded.

@Pomax
Copy link

Pomax commented Jul 18, 2016

I'm using fixable loosely - seeing the line in question and the file it was signalled in is just as good of course. The problem I had was seeing the equivalent of "something went wrong" without any additional information, so if phantom generates more data (file+line number for instance) but mocha-phantom right now doesn't proxy that to the console, that would be quite valueable to fix

@ghost
Copy link

ghost commented Oct 23, 2016

just noticed that phantomjs is deprecated and was renamed to phantomjs-prebuilt. annoying to update dependencies and I noticed it's still at 1.9.x in the package.json.

@jpgcode
Copy link

jpgcode commented Oct 28, 2016

Hi, can someone give an update on this one? This module is still using phantomjs 1.9.x, It is hard to upgrade it to version 2?

@jpgcode
Copy link

jpgcode commented Oct 28, 2016

Nevermind, just read the above comments, it works with mocha-phantomjs-core. Please update this ticket or mark this project as deprecated in favor of mocha-phantomjs-core if this project will not be longer maintained.

@nathanboktae
Copy link
Owner

Yeah I need to move the command line parsing over to mocha-phantomjs-core before I can tell everyone to switch over. Also you can use phantomjs2 with this by pointing to the phantomjs2 binary with the-p option.

@Pomax
Copy link

Pomax commented Oct 29, 2016

@nathanboktae good idea to put that information prominently at the top of the README.md (probably in a short section after "Usage" titled "Using with Phantom 2.x" and then maybe even refer to that section already all the way at the start of the README.md doc?) rather than having it only as a comment in a closed issue. This information deserves some permanence, at least until the CLI parsing's been switched over.

@nathanboktae
Copy link
Owner

Good idea @Pomax I'll add it to the README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests