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
Switch test suite from PhantomJS to Karma #626
Conversation
Chrome and Firefox both split `append`d values with `, `.
`signal.listeners` is not available in native implementations of AbortSignal.
Safari aggressively caches `/slow` endpoint after first load and serves it up really fast on subsequent runs, not giving it enough time to invoke `controller.abort()`. Adding `Cache-Control` response headers from the server doesn't work. Safari still serves `/slow` from disk cache, even though `/slow` was never even allowed to finish on prior runs. My guess is that Safari erroneously caches the result of `/slow` when the initial request was aborted.
Just like in Chrome, this isn't supported natively.
.travis.yml
Outdated
chrome: stable | ||
before_script: | ||
- export DISPLAY=:99.0 | ||
- sh -e /etc/init.d/xvfb start |
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.
Do we still need xfvb
if we are using a headless version of Firefox/Chrome?
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 believe so
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 looked it up and developers.google.com says:
So I still need Xvfb?
No. Headless Chrome doesn't use a window so a display server like Xvfb is no longer needed. You can happily run your automated tests without it.
What is Xvfb? Xvfb is an in-memory display server for Unix-like systems that enables you to run graphical applications (like Chrome) without an attached physical display. Many people use Xvfb to run earlier versions of Chrome to do "headless" testing.
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 still have it in https://github.com/chaijs/type-detect/blob/master/.travis.yml and I cannot remember why, but I'm sure I would have removed it if it was no longer needed. Perhaps Firefox still needs it? I'd be happy to be wrong though 😛
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 think the headless browsers will work without xvfb
. It should be easy enough to test 😄
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 made a PR to remove that pre-test step in type-detect
and it's running 🍏
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.
Thanks for the PR @koddsson. Consider me happily wrong. Let's get rid of these lines here too!
This should help Firefox 56 in CI which doesn't have AbortController.
I was just cargo-culting it from other setups
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.
❤️
@@ -2,9 +2,12 @@ sudo: false | |||
language: node_js | |||
node_js: | |||
- "node" | |||
dist: trusty |
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.
Trusty is the default test environment now, so we don't need to specify it here.
I've needed sudo: true
for Chrome headless to work in the past. That issue may be fixed now, though.
Adapted from JakeChampion/fetch#626
npm t
now runs the test suite in headless Chrome/Firefox.With
npm run karma
, additional browsers may be connected to the Karma runner and automatically re-run tests when files change.