Bad timing routing issue, failing test#16342
Conversation
c003bf5 to
2eb6799
Compare
2eb6799 to
490042f
Compare
|
|
||
| this.add('route:dummy', Route.extend({ | ||
| redirect() { | ||
| return RSVP.resolve() |
There was a problem hiding this comment.
If I understand well, this is specifically what the test is about ?
490042f to
2b206f9
Compare
|
@wagenet I've updated (locally) this test to highlight the real issue (it needs an expectDeprecation because of the call to this.replaceWith()). |
| 'route:dummy', | ||
| Route.extend({ | ||
| redirect() { | ||
| return RSVP.resolve().then(() => this.replaceWith('index')); |
There was a problem hiding this comment.
Needs something like this:
expectDeprecation(() => {
this.replaceWith('index');
}, 'Calling replaceWith on a route is deprecated. Use the RouterService instead.');
2b206f9 to
1801921
Compare
|
@rwjblue @wagenet, Could you guys please explain me the difference in term of behavior using Because for me, they are be the same. The one from Peter's test (somehow makes the test fail) The one I just tried (the test is green this way). I was thinking maybe await Promise.resolve() would be somehow synchronous, so I modified resolving the Promise after 500ms, and it's working too: |
|
I've made some other tiny experiment around redirect() {
return new RSVP.Promise((resolve) => {
count++;
// later(resolve, 1); // pass
// later(resolve, 0); // pass
// next(resolve); // pass
// run(resolve); // fails
// resolve(); // fails
}).then(() => {
assert.equal(count, 1);
expectDeprecation(() => {
this.replaceWith('index');
}, 'Calling replaceWith on a route is deprecated. Use the RouterService instead.');
});
},
async redirect() {
await new RSVP.Promise((resolve) => {
count++;
// later(resolve, 1); // pass
// later(resolve, 0); // pass
// next(resolve); // pass
// run(resolve); // pass
// resolve(); // pass
});
assert.equal(count, 1);
expectDeprecation(() => {
this.replaceWith('index');
}, 'Calling replaceWith on a route is deprecated. Use the RouterService instead.');
}, |
|
Possibly it has to do with the difference in the code generated by the transpiler. |
|
@wagenet I've had a discussion with @rwjblue on this thing. From the discord chat:
seems related to: emberjs/router.js#310 and emberjs/ember-test-helpers#332
|
|
@wagenet is this still relevant? |
1801921 to
e5564cc
Compare
|
@locks I just rebased. Looks like CI still fails. |
|
Is this still relevant? |
e5564cc to
fe99bd9
Compare
|
Rebased again. If this still fails, it's relevant though if we replace the router then it won't be :D |


Not really sure what to name this, or if this test is in the right area,
but it is an issue!