Skip to content

Introduce setupTestAdapter hook#1165

Merged
chancancode merged 2 commits intomasterfrom
setup-test-adapter-hook
Mar 31, 2020
Merged

Introduce setupTestAdapter hook#1165
chancancode merged 2 commits intomasterfrom
setup-test-adapter-hook

Conversation

@chancancode
Copy link
Copy Markdown
Member

While working on #1163, we encountered an issue with the test adapter, where unmet expectations (when you set up a respondTo for a test that was never triggered) did not cause the offending test to fail. Instead, they became unhandled promise rejections (i.e. "global errors") and fails the next test that runs.

This is because we were using the QUnit.{testStart,testDone} hooks as if they were a global version of {before,after}Each. However, the global hooks are really intended for things like test reporters and runs too late to affect things like the pass or fail status of a test.

This commit introduces a setupTestAdapter function that uses the normal (not global) APIs so that the failures are attached to the correct test.

@chancancode
Copy link
Copy Markdown
Member Author

cc @SYU15

@SYU15
Copy link
Copy Markdown
Member

SYU15 commented Mar 31, 2020

Thanks @chancancode!

While working on #1163, we encountered an issue with the test
adapter, where unmet expectations (when you set up a `respondTo`
for a test that was never triggered) did not cause the offending
test to fail. Instead, they became unhandled promise rejections
(i.e. "global errors") and fails the _next_ test that runs.

This is because we were using the `QUnit.{testStart,testDone}`
hooks as if they were a global version of `{before,after}Each`.
However, the global hooks are really intended for things like
test reporters and runs too late to affect things like the pass
or fail status of a test.

This commit introduces a `setupTestAdapter` function that uses
the normal (not global) APIs so that the failures are attached
to the correct test.
@chancancode chancancode force-pushed the setup-test-adapter-hook branch from 43d87d6 to 5d103ee Compare March 31, 2020 06:41
@chancancode
Copy link
Copy Markdown
Member Author

canary failure is not related, @pzuraq is aware of it

@chancancode chancancode merged commit 1eeb93d into master Mar 31, 2020
@chancancode chancancode deleted the setup-test-adapter-hook branch March 31, 2020 21:21
nummi pushed a commit to nummi/ember-inspector that referenced this pull request Apr 5, 2020
While working on emberjs#1163, we encountered an issue with the test
adapter, where unmet expectations (when you set up a `respondTo`
for a test that was never triggered) did not cause the offending
test to fail. Instead, they became unhandled promise rejections
(i.e. "global errors") and fails the _next_ test that runs.

This is because we were using the `QUnit.{testStart,testDone}`
hooks as if they were a global version of `{before,after}Each`.
However, the global hooks are really intended for things like
test reporters and runs too late to affect things like the pass
or fail status of a test.

This commit introduces a `setupTestAdapter` function that uses
the normal (not global) APIs so that the failures are attached
to the correct test.
patricklx pushed a commit to patricklx/ember-inspector that referenced this pull request Sep 19, 2022
While working on emberjs#1163, we encountered an issue with the test
adapter, where unmet expectations (when you set up a `respondTo`
for a test that was never triggered) did not cause the offending
test to fail. Instead, they became unhandled promise rejections
(i.e. "global errors") and fails the _next_ test that runs.

This is because we were using the `QUnit.{testStart,testDone}`
hooks as if they were a global version of `{before,after}Each`.
However, the global hooks are really intended for things like
test reporters and runs too late to affect things like the pass
or fail status of a test.

This commit introduces a `setupTestAdapter` function that uses
the normal (not global) APIs so that the failures are attached
to the correct test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants