Skip to content

Commit

Permalink
Improve coverage on AsyncHooksScopeManager (open-telemetry#178)
Browse files Browse the repository at this point in the history
* fix: / update gitignore
.gitignore to ignore .nyc_output

* fix: increase feature coverage on ScopeManager

closes open-telemetry#163

* fix: use strictEqual()

* fix: typo
  • Loading branch information
danielkhan authored and mayurkale22 committed Aug 8, 2019
1 parent 39a0541 commit 68d8f9d
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,28 @@ describe('AsyncHooksScopeManager', () => {
return done();
});
});

it('should rethrow errors', done => {
assert.throws(() => {
scopeManager.with(null, () => {
throw new Error('This should be rethrown');
});
});
return done();
});

it('should finally restore an old scope', done => {
const scope1 = 'scope1';
const scope2 = 'scope2';
scopeManager.with(scope1, () => {
assert.strictEqual(scopeManager.active(), 'scope1');
scopeManager.with(scope2, () => {
assert.strictEqual(scopeManager.active(), 'scope2');
});
assert.strictEqual(scopeManager.active(), 'scope1');
return done();
});
});
});

describe('.bind(function)', () => {
Expand Down

0 comments on commit 68d8f9d

Please sign in to comment.