We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2a05240 commit 37bfce5Copy full SHA for 37bfce5
src/spec.js
@@ -135,6 +135,30 @@ describe('Context', () => {
135
initialContext
136
));
137
});
138
+
139
+ describe('Errors', () => {
140
+ const runWithinPromise = () => new Promise((resolve, reject) => {
141
+ const error = new Error('Promise failed');
142
+ Context.run(() => reject(error));
143
+ });
144
145
+ it('Bubbles up error', () => {
146
+ const errorFn = () => {
147
+ throw new Error('That went badly.');
148
+ }
149
+ expect(() => Context.run(errorFn)).toThrow();
150
151
152
+ it('Rejects promises', async (done) => {
153
+ try {
154
+ await runWithinPromise();
155
+ expect(true).toBeFlasy();
156
+ } catch (e) {
157
+ expect(e).toBeInstanceOf(Error)
158
+ done();
159
160
161
162
163
164
0 commit comments