1 | import { BaseContext } from './setup-context';
|
2 | /**
|
3 | * Sets the `Ember.onerror` function for tests. This value is intended to be reset after
|
4 | * each test to ensure correct test isolation. To reset, you should simply call `setupOnerror`
|
5 | * without an `onError` argument.
|
6 | *
|
7 | * @public
|
8 | * @param {Function} onError the onError function to be set on Ember.onerror
|
9 | *
|
10 | * @example <caption>Example implementation for `ember-qunit` or `ember-mocha`</caption>
|
11 | *
|
12 | * import { setupOnerror } from '@ember/test-helpers';
|
13 | *
|
14 | * test('Ember.onerror is stubbed properly', function(assert) {
|
15 | * setupOnerror(function(err) {
|
16 | * assert.ok(err);
|
17 | * });
|
18 | * });
|
19 | */
|
20 | export default function setupOnerror(onError?: (error: Error) => void): void;
|
21 | /**
|
22 | * Resets `Ember.onerror` to the value it originally was at the start of the test run.
|
23 | * If there is no context or cached value this is a no-op.
|
24 | *
|
25 | * @public
|
26 | *
|
27 | * @example
|
28 | *
|
29 | * import { resetOnerror } from '@ember/test-helpers';
|
30 | *
|
31 | * QUnit.testDone(function() {
|
32 | * resetOnerror();
|
33 | * })
|
34 | */
|
35 | export declare function resetOnerror(): void;
|
36 | /**
|
37 | * Caches the current value of Ember.onerror. When `setupOnerror` is called without a value
|
38 | * or when `resetOnerror` is called the value will be set to what was cached here.
|
39 | *
|
40 | * @private
|
41 | * @param {BaseContext} context the text context
|
42 | */
|
43 | export declare function _prepareOnerror(context: BaseContext): void;
|
44 | /**
|
45 | * Removes the cached value of Ember.onerror.
|
46 | *
|
47 | * @private
|
48 | * @param {BaseContext} context the text context
|
49 | */
|
50 | export declare function _cleanupOnerror(context: BaseContext): void;
|
51 | //# sourceMappingURL=setup-onerror.d.ts.map |
\ | No newline at end of file |