Improve not-a-function error message#50
Open
gnclmorais wants to merge 1 commit intoemberjs:masterfrom
Open
Conversation
When the passed `fn` to the helper is not a function, this commit improves the error message users will see, hopefully helping with the debugging process. Fixes emberjs#23
SergeAstapov
approved these changes
Oct 27, 2021
| assert.dom('.alert').hasClass('fade-in'); | ||
| }); | ||
|
|
||
| test('provides a useful error on insert', async function (assert) { |
Contributor
There was a problem hiding this comment.
@gnclmorais nitpick, maybe name it provides a useful error when provided not a function?
Same for other tests.
Just so that mentally in future we may add some other "useful error on insert" for another use case
| nonExistentMethod: undefined, | ||
| show: false, | ||
| }); | ||
|
|
Contributor
There was a problem hiding this comment.
@gnclmorais looks like this test fails. Di you try you add await settled() before setupOnerror() so that it re-renders and emit error and only after that resets?
Author
There was a problem hiding this comment.
I’ve tried a couple of things to make sure this would work (your suggestion was one of them), but no luck so far… Curiously, it only fails with three older versions of Ember:
Scenario ember-lts-3.8: FAIL
Command run: ember test
┌────────────────────┬────────────────────┬──────────────────────────────┬──────────┐
│ Dependency │ Expected │ Used │ Type │
├────────────────────┼────────────────────┼──────────────────────────────┼──────────┤
│ ember-source │ ~3.8.0 │ 3.8.3 │ yarn │
└────────────────────┴────────────────────┴──────────────────────────────┴──────────┘
Scenario ember-lts-3.12: FAIL
Command run: ember test
┌────────────────────┬────────────────────┬──────────────────────────────┬──────────┐
│ Dependency │ Expected │ Used │ Type │
├────────────────────┼────────────────────┼──────────────────────────────┼──────────┤
│ ember-source │ ~3.12.0 │ 3.12.4 │ yarn │
└────────────────────┴────────────────────┴──────────────────────────────┴──────────┘
Scenario ember-lts-3.16: FAIL
Command run: ember test
┌────────────────────┬────────────────────┬──────────────────────────────┬──────────┐
│ Dependency │ Expected │ Used │ Type │
├────────────────────┼────────────────────┼──────────────────────────────┼──────────┤
│ ember-source │ ~3.16.0 │ 3.16.10 │ yarn │
└────────────────────┴────────────────────┴──────────────────────────────┴──────────┘
Do you think we could potentially run these tests on all versions except these?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #23. When the passed
fnto the helper is not a function, this commit improves the error message users will see, hopefully helping with the debugging process.First time contributing to an Ember project, so feel free to give me any feedback you have. Cheers!