-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[FEAT] assert transitions on destroyed app instances #16386
[FEAT] assert transitions on destroyed app instances #16386
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.
Looks good! Can you add a test for the assertion also?
|
||
router.currentRouteName = 'route-a'; | ||
|
||
assert.throws(function() { |
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.
Since assertions are stripped in production builds (and we run tests against production builds) this will need to be tweaked. The main update should be to replace assert.throws
with expectAssertion
(which is a global).
|
||
assert.throws(function() { | ||
router.transitionTo('route-b'); | ||
}, "A transition was attempted from 'route-a' to 'route-b' but the application instance has already been destroyed."); |
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 will work fine once you migrate to expectAssertion
, but I figured I’d point out that this definitely doesn’t do what you expect with assert.throws
. Specifically, passing assert.throws
two arguments (a function and a string) does not use the provided string as a matcher for the error message but instead uses the second arg as the label for the assertion. It’s a super super trolly api 😭
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.
sad face
21b50c4
to
246e16a
Compare
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.
Failed assertion: Expected failing Ember.assert: 'A transition was attempted from 'route-a' to 'route-b' but the application instance has already been destroyed.', but got 'The route route-b was not found'., expected: A transition was attempted from 'route-a' to 'route-b' but the application instance has already been destroyed.
@rwjblue odd. That test was running fine locally. I’ll take a peek. |
No description provided.