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

Support Ember apps that remove jquery. #58

Merged
merged 10 commits into from
Mar 21, 2018
Merged

Support Ember apps that remove jquery. #58

merged 10 commits into from
Mar 21, 2018

Conversation

fotinakis
Copy link
Contributor

@fotinakis fotinakis commented Mar 14, 2018

Support Ember apps that remove jquery like this:
https://shipshape.io/blog/ember-without-jquery/

  • Remain 100% backwards compatible with current addon behavior, but allow Ember apps to strip jquery from their production builds. We do this by including a vendorized version of jquery (percy-jquery.js), and only loading it into ember apps in test mode. This makes ember-percy keeps its exact same behavior, but allow users to strip jquery. Long-term we can remove each dependency on jquery over time when we're sure we can safely replicate the behaviors of things like .clone() and such.

  • While we're at it, also upgrade this addon's own tests to the new format to make sure we're compatible with modern non-jquery based test helpers.

@fotinakis fotinakis changed the title [WIP] Remove reliance on Ember.$. Support Ember apps that remove jquery. Mar 19, 2018
@@ -153,6 +153,11 @@ module.exports = {
}
},

included: function(app) {
this._super.included(app);
app.import('vendor/percy-jquery.js', {type: 'test'});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to think about this slightly more — we technically support people right now exporting PERCY_TOKEN in development mode, running ember server (instead of ember test) and navigating to /tests and getting snapshots. I don't think that's a common flow or one we care to support, but need to think slightly more about this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this will break the ability to go to localhost:whatever/tests? Or only getting percy snapshots locally through localhost:whatever/tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only getting percy snapshots when running /tests locally, which I don't think anyone does.

@fotinakis fotinakis requested a review from cadeParade March 20, 2018 20:45
@fotinakis fotinakis mentioned this pull request Mar 20, 2018
4 tasks
@@ -153,6 +153,11 @@ module.exports = {
}
},

included: function(app) {
this._super.included(app);
app.import('vendor/percy-jquery.js', {type: 'test'});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this will break the ability to go to localhost:whatever/tests? Or only getting percy snapshots locally through localhost:whatever/tests?

assert.equal(currentURL(), '/');
percySnapshot('dupe test');
// Test duplicate name (should log warning and skip this snapshot):
percySnapshot('dupe test');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we know the snapshot is skipped instead of overwritten? Maybe it doesn't matter? I guess I always assumed it was just overwritten...
We also are not testing the log output so not sure if this test is useful?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per discussion, this is a regression test for making sure that dupe tests are handled correctly. Yeah it could be more thoroughly tested via log output, but there are many places in ember-percy where we integration test things anyway.

@fotinakis
Copy link
Contributor Author

Have tested this with https://github.com/percy/percy-web, all 👍

@fotinakis fotinakis merged commit 4595c33 into master Mar 21, 2018
@fotinakis fotinakis deleted the vendored-jquery branch March 21, 2018 18:18
@fotinakis
Copy link
Contributor Author

Released in v1.4.0.

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

Successfully merging this pull request may close these issues.

2 participants