Don't swallow deprecations and warnings when there is no test context #1320
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.
Allow them to proceed to the next handler.
Observed this behavior in an application: Deprecations thrown outside of a running test are swallowed by this handler. For example, when running tests on ember-resolver, no @ember/string deprecations are thrown, even though deprecate is called.
I am not sure if this was intentional, but it makes it hard to test that a deprecation isn't thrown by a package.
How can this be tested in the test suite here?
I attempted various ways to test this in the test suite but was unsuccessful. I attempted to add my own registerDeprecationHandler to confirm it was called by the one in
setup-context
, but I was not able to register my handler in advance of the handler insetup-context
, which means mine was always called before the one insetup-context
. My attempted test never failed. Is there a good way to inspect the console output? I am mostly concerned with the default logging handler.This change can be confirmed in a project (as I have in ember-resolver) and also there are a few tests in the suite that trigger deprecations without a context. Before this change, they do not log to the console, after, they do.