-
Notifications
You must be signed in to change notification settings - Fork 44
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
Remove jQuery #45
Remove jQuery #45
Conversation
addon/snapshot.js
Outdated
@@ -1,6 +1,10 @@ | |||
import Ember from 'ember'; | |||
import { getNativeXhr } from './native-xhr'; | |||
import { maybeDisableMockjax, maybeResetMockjax } from './mockjax-wrapper'; | |||
import $ from 'jquery'; |
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.
Whoa.
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.
😄
If you're interested in updating ember-cli-babel
to version 6.3+ (I believe) you could also use the new Ember imports outlined here: https://github.com/ember-cli/ember-rfc176-data but that would likely be appropriate for another PR. There are tools to automate the change as well. Let me know if you're interested!
- setup ember-try to only include the event dispatcher in compatible version of Ember - add a targets config - reformat testem config - configure the build to only remove jquery if the events dispatcher is available - fix integration component test
d5feca0
to
9ade1d1
Compare
9ade1d1
to
46770e4
Compare
14a1b75
to
3bcbcef
Compare
b19fad8
to
a855ae8
Compare
a855ae8
to
9dc3f5b
Compare
Hi @fotinakis, this seems to be in a working state, but could use some further testing to make sure the proper snapshots are being taken. Regarding your previous instructions, should I be able to Also, I needed to change 1 test as it seems like there are still some Ember internals that use jQuery related to handling checkbox input events. I also updated some dependencies and had the tests run Node 6, and 8 instead of 4. I upgraded Please let me know when you have a chance to review this and if there are any changes you'd like to see before it's acceptable to merge. Thanks! |
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.
@jeffjewiss this is looking good, thanks for all the work here! Added some review comments here.
As for the tests, yes you can npm link it into a project to test (I will plan on doing that for our own projects before merging this). Also easier: just create a new project like test-ember-percy
in percy, checkout master of this addon itself and run the tests pointed at that project, then checkout your branch locally and run the tests again to make sure nothing has changed. You can also run it locally with PERCY_BRANCH=test npm test
to override the that Percy thinks it's coming from, which will default to master.
Let me know if that all makes sense or any questions on my comments here.
addon/snapshot.js
Outdated
import { getNativeXhr } from './native-xhr'; | ||
import { maybeDisableMockjax, maybeResetMockjax } from './mockjax-wrapper'; | ||
import ajax from 'ember-fetch/ajax'; | ||
import run from 'ember-runloop'; |
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 kind of confused as to why this works, and can't find any references to doing it this way. Is there a preference for this over destructuring run
off of the Ember
object?
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.
This is working because ember-cli-shims is included as a dependency. Destructuring from the Ember
object is now generally not recommended.
Ember is slowly moving towards using separate packages, so the preference is to import from these packages so that when future improvements are added to the build process (tree-shaking with rollup) it will result in smaller build files.
import run from 'ember-runloop';
then becomes import { run } from '@ember/runloop';
and a list of these new module imports can be found here: https://github.com/ember-cli/ember-rfc176-data
The documentation and guides are also in the process of being updated as of [email protected] and you can see the beginning of this: https://emberjs.com/api/ember/2.16/classes/@ember%2Frunloop
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.
Makes total sense, thanks for the great explanation! Looks like I've been slacking on keeping my Ember knowledge up to date. :)
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.
You're welcome, glad that was helpful. No worries, it's a lot of work to stay up to date. 😄
.travis.yml
Outdated
|
||
install: | ||
- mkdir travis-phantomjs |
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.
It seems in the testem config you updated it to not use phantomjs at all — which is 👍 , but I think this needs to be updated and cleaned up as well. You can probably just use Travis's normal method for making sure Chrome is available: https://docs.travis-ci.com/user/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.
Okay cool, looks like this was left over as I updated the Travis config in stages. I'll clean up the .travis.yml
file.
.travis.yml
Outdated
- PERCY_ENABLE=0 EMBER_TRY_SCENARIO=ember-1.13 | ||
- PERCY_ENABLE=0 EMBER_TRY_SCENARIO=ember-lts-2.4 | ||
- PERCY_ENABLE=0 EMBER_TRY_SCENARIO=ember-lts-2.8 | ||
- PERCY_ENABLE=0 EMBER_TRY_SCENARIO=ember-lts-2.12 |
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.
Will we have to break backwards-compatibility with Ember 1.13 as part of this change? If not, let's keep the ember-1.13 try here.
Overall, if it required to drop 1.13 support, we're probably ready for that and fine with it, just need to bump a major release of this after it is merged.
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'll look at getting Node 4 working on Travis first, and then try adding this back in.
These changes should work fine with Ember 1.13. I removed that version to use more recent versions of Ember and because there seemed to be some weird caching/installation behaviour with ember-try
on Travis.
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.
Sounds good. If it ends up being a lot of work to get ember-try with 1.13 tests to work, then feel free to drop.
.travis.yml
Outdated
@@ -1,19 +1,25 @@ | |||
--- | |||
language: node_js | |||
node_js: | |||
- "4" | |||
- 6 |
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'd like to maintain Node 4 compatibility, especially because there are Node 4 LTS releases that don't fall out of maintenance until April 2018 (https://github.com/nodejs/Release).
Can you add back Node 4 here, and see comment below in package.json about Node 4 version.
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.
Yes, no problem. I'll add that back in.
I initially removed it because I was able to have the add-on build and pass all the tests locally running Node 4, however Travis was throwing errors. The error seemed to be related to a missing "use strict;", but I had added it to the referenced file. So I think there may be a caching or other issue.
tests/.eslintrc.js
Outdated
env: { | ||
browser: true | ||
}, | ||
globals: {}, |
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 sure why you didn't have to have percySnapshot
defined here, if eslint still passes then great.
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 updated the tests to use import { percySnapshot } from 'ember-percy';
. This imports from the add-on instead of having to use the test helper.
I could either keep this method and remove the test helper, or revert to using the helper and add percySnapshot
to the eslint globals. I thought it would be better to not use globals. Which do you prefer?
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.
Ah very interesting. So our current docs say to ignore it here and import our register-helpers
module to install our Ember async helper, so that in acceptance tests you always rely on the global and it works well with the other async helpers like visit
, click
etc. This is required in normal acceptance tests so that it doesn't have to be nested in an andThen()
to get into the right order.
Since you've migrated the tests here to ember-native-dom-helpers
and are using await
it may not matter anymore in this case, the only slightly weird part I can think of is that we like using this repository as an example of writing Percy tests the recommended way. I'm not sure of the state of grand testing unification, but we'll need to support the Ember async helpers workflow for a long while.
Just some thoughts, I don't really have strong feelings here either way — just wanted to point out the effect on our docs and our currently recommended workflow for acceptance tests. What do you think we should do here?
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 detailed explanation. I agree that consistency and being able to use this repo as an example of writing Percy tests is important. So with that in mind I added the percySnapshot
global back in for tests. I think it makes sense to keep and support the async helper.
@@ -16,40 +16,46 @@ | |||
}, | |||
"repository": "https://github.com/percy/ember-percy", | |||
"engines": { | |||
"node": ">= 0.12.0" | |||
"node": "^4.5 || 6.* || >= 7.*" |
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.
Related to comment in travis.yml, we'd like to maintain backwards compatibility for Node 4.x releases if possible. Can you explain a bit more about this line change?
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 pulled this engine setup from here: https://github.com/ember-cli/ember-cli/blob/master/package.json#L148
I've generally seen this mentioned as the recommendation by ember-cli and for ember projects/add-ons. I believe the idea is to support LTS versions of Node, but with the preference of a more stable version of 4.
@fotinakis thanks for taking a look at this, I realize it's a big change. Thanks for all the comments. I've answered each one and then added todos at the top of the PR for any outstanding tasks that came out of the comments. I'll work through them and ping you again when they're complete. |
* upgrade ember-cli to 2.16 * config travis and ember-cli to test Ember 1.13
28a2425
to
f1b813e
Compare
@jeffjewiss thanks for all the hard work on this PR! Responded to a few comments above. |
9987d8c
to
fe45f67
Compare
fe45f67
to
ca05a92
Compare
f8ac372
to
f0d276d
Compare
@fotinakis I had to update the I think I have all the issues fixed, however I ran out of builds on my Percy free trial. Would it be possible to get that reset or would you be able to take over confirming that the snapshots from this branch are the same as master? |
@jeffjewiss sorry for the delayed response here. Yes definitely, I've just extended your trial. We also are about to merge something in #47 that will have a tiny impact on this PR and need to be merged in. |
@fotinakis no problem! Okay great. Thanks for the heads up, I've merged master into this branch and made the appropriate updates to My snapshots are now uploading correctly. This revealed an issue with cloning I think this should be ready for a final review. 🎉 |
Hey @fotinakis, just wanted to ping you on this and see if you had a chance to look at it. Cheers! |
* master: 1.2.21 Upgrade pinned version of percy-client.
Hey, just wanted to check in on this and see if anyone had a chance to take a look at it. Thanks! |
Ember.js is actively making jQuery optional, this would be a great time to get this landed 👍 |
27554e0
to
a4d4345
Compare
How's this going @jeffjewiss @fotinakis? This is one thing keeping me from using Percy right now, since I need to remove jQuery from my apps. Do you guys need any help? |
Hey @rwwagner90, from what I remember this PR was working (tests passing, and uploading the correct snapshots) back in October when I posted the update. I didn't hear back re: feedback and haven't looked into why the most recent merge broke things. |
@fotinakis what do we need to do to get this in? |
Closing in preference for #58 Thanks for pushing us to get this done @jeffjewiss. We decided on an interesting path that allows us to keep all of our current jquery-dependent behaviors in tests, while still allowing people to strip jquery from their production Ember builds. |
Removes jQuery as a dependency.
Fixes #37
todo:
.travis.yml
master
branch