-
Notifications
You must be signed in to change notification settings - Fork 13
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
Upgrade Ember Data to version 4.12.4
#974
Conversation
ebca71f
to
f418a97
Compare
4.12.3
4.12.4
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #974 +/- ##
==========================================
- Coverage 75.34% 75.09% -0.25%
==========================================
Files 351 351
Lines 3265 3265
Branches 274 274
==========================================
- Hits 2460 2452 -8
- Misses 713 718 +5
- Partials 92 95 +3 ☔ View full report in Codecov by Sentry. |
f418a97
to
fcf0a6e
Compare
d7a0a55
to
8a6526f
Compare
b3b36e0
to
b5bdfdb
Compare
return { | ||
buildSandboxGlobals(defaultGlobals) { | ||
return Object.assign({}, defaultGlobals, { | ||
AbortController, |
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.
@VasylMarchuk I remember that you linked to some github issue that mentioned this - can we add a comment linking to that here please?
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 found a reference to a similar problem in this discussion: https://discuss.emberjs.com/t/abortcontroller-errors-after-update/20259/4
It links to an issue in the FastBoot repo: ember-fastboot/ember-cli-fastboot#913
There is a vague reference to this buildSandboxGlobals
in the FastBoot readme as well: https://github.com/ember-fastboot/ember-cli-fastboot#fastboot-configuration
Basically, some of the newer global types/methods (fetch, AbortController, ReadableStream etc) have to be explicitly defined in this list of "globals" that FastBoot makes available in the "sandbox", even though they are natively present in node itself long ago. And it's not really clear and nowhere mentioned in the docs about what's already in this sandbox and what has to be passed explicitly.
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.
@VasylMarchuk I meant to add a comment in the code 🙂 Just for future reference, in case someone wonders what this does
@@ -61,6 +62,8 @@ module('Acceptance | concept-admin | edit-blocks', function (hooks) { | |||
await blocksPage.editableBlocks[1].clickOnSaveButton(); | |||
|
|||
await blocksPage.clickOnPublishChangesButton(); | |||
await settled(); |
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 interesting - clickOnPublishChangesButton
internally uses clickable()
from ember-cli-page-object
, and that should be calling settled()
automatically.
This can be problematic, it'll mean that we have to keep adding settled()
in random places without exactly knowing what we're waiting on... I did try this locally, and it looks like when settled()
isn't present, blocksWithMetadata
(the property that renders editableBlocks) is recomputed after the assertion occurs here. This basically throws all determinism in tests out of whack - I wonder if this'll end up leading to spurious failures over time.
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.
@VasylMarchuk probably okay to merge this for now, could you please add a comment to all of these saying // Investigate why clickable() doesn't call settled()
or something like that?
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 sounds like a good idea, I also found having to add explicit settled
calls weird and suspicious.
It feels like some async action is happening, which isn't getting included in the ember run-loop, and isn't tracked automatically by test waiters, then it registers a promise or a Ember.run.later
, and that promise is awaited on by the extra settled
call. Maybe it's the new RequestManager misbehaving, maybe it's our own async logic somewhere.
Also in one of my previous projects, we had to manually call waitForPromise
from @ember/test-waiters
to get our tests to wait for our custom async logic, like this:
https://github.com/emberjs/ember-test-waiters/blob/master/addon/addon/wait-for-promise.ts
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.
But also, on the other hand, what's strange is that we have 277 tests, but only 8 tests were failing and I needed to add only 9 extra await settled()
calls in 7 files...
Will definitely add a comment and maybe worth an extra investigation in a separate PR
Brief
This is a pull request to upgrade
ember-data
from4.11.3
to4.12.4
Details
After upgrading to latest
[email protected]
,AbortController
was missing during FastBoot-enabled builds and causing a build error. It had to be added to FastBoot's "sandbox globals". In addition, some of the tests started failing and had to be adjusted or fixed:AbortController
to FastBoot'sbuildSandboxGlobals
setupAnimationTest
callawait settled()
callawait animationsSettled()
callChecklist
[percy]
in the message to trigger)