-
Notifications
You must be signed in to change notification settings - Fork 473
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
Tests: Replace PhantomJS with Karma/Chrome #295
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this based on Core changes?
Two things:
- The Travis config changes need to be migrated from Core as well.
- Some tests are failing in Chrome Headless, they need to be fixed before landing this.
This is failing right now, it seems because it needs sudo set in the Travis config. @timmywil @Krinkle before just blindly doing that would you mind looking at what I've set up and see if there is anything else required? It runs locally. I think I probably need some additional incantations in the Travis file besides sudo. |
ohai @mgol ! what tests are failing? Nothing was failing locally. |
As for addons:
chrome: stable Have a look at https://github.com/jquery/jquery/blob/master/.travis.yml, it's not that complex. |
Tests are fine, false alarm. This is because our npm scripts setup is not ideal. Core's package.json is, again, a good indication in what we may want here as well: |
Oh, the Travis ticket linked from Core's Travis config (i.e. travis-ci/travis-ci#8836) is fixed now. Perhaps you just need to add the |
...and if just adding the Chrome add-on doesn't work you may want to try disabling the Chrome sandbox, here's how: If that helps, please configure it so that on a local machine it doesn't use this sandboxless Chrome, only on Travis. |
Yeah. Chrome’s sandbox doesn’t work anymore inside Docker containers as of a few releases ago. For the moment either requires VM/sudo, or disabling the sandbox via Karma. Could be conditional inside Gruntfile based on a Travis env var. |
Thanks, Timo. I've tried it and it works! See the Core PR: jquery/jquery#4011 @dmethvin you can do something like what I did in Core. |
Thanks @mgol, the tests seem to be working now. Do the changes look good to you? |
Gruntfile.js
Outdated
@@ -100,6 +84,65 @@ module.exports = function( grunt ) { | |||
} | |||
} | |||
}, | |||
karma: { | |||
options: { | |||
customContextFile: "karma/context.html", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure, but it seems like we don't need the custom files. With the custom things for core removed, it looks like they're just the default now. Do the tests can pass without these files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Krinkle the standard file seems to run fine, but when i use the debug file I don't see any output on the screen. Also, on Windows although I can run the tests for debug I'm not sure how to exit the browser it launches in a way that Karma understands it was successful. If I close the browser it thinks Chrome crashed so it tries to relaunch 2 times and then hangs my command prompt.
.travis.yml
Outdated
addons: | ||
chrome: stable | ||
env: | ||
- NPM_SCRIPT=test:browserless |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have such an npm script in Migrate. You might want to migrate that from Core if you want but for now it seems you can just remove the whole env
block?
I've removed the custom files. It looks like I can still debug locally and the tests pass. When I'm debugging should I actually see the QUnit tests in the window? I don't, although I can still debug and see the results from the console which is enough I suppose. |
@dmethvin Yeah, the HTML is all there, so it is using the regular "Web/HTML" reporter of QUnit, but karma-qunit doesn't load the css file by default and doesn't create the However, it will do both of those things if you set Should be harmless to just enable always. |
Thanks @Krinkle! That fixes the display issue. There is still a problem with Karma detecting that I've closed the debugging browser. Not sure how to deal with that, any ideas? That issue isn't blocking anything though. I really want to land this soon to finish some other PRs stuck behind it. I think @mgol is traveling now so if it looks good to you I'll land it. |
As part of this I also had to pull out the coverage code, which already seemed to be broken anyway, since it also used PhantomJS.