Skip to content

Commit

Permalink
fix: Broken travis tests on master, Fix node tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HazAT committed Jul 5, 2018
1 parent 867c8b6 commit 5601a14
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
4 changes: 4 additions & 0 deletions .travis/before_script.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/bin/bash
set -e

if [[ $TRAVIS_BRANCH == 'master' ]]; then
CHANGES="[force ci]"
else
CHANGES=$(git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD master))
fi

if [ -n "$(grep 'raven-js' <<< "$CHANGES")" ]; then
RAVEN_JS_CHANGES=true
Expand Down
4 changes: 2 additions & 2 deletions packages/hub/src/hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class Hub {
* Internal helper function to call a method on the top client if it exists.
*
* @param method The method to call on the client/client.
* @param args Arguments to pass to the client/fontend.
* @param args Arguments to pass to the client/frontend.
*/
private invokeClient(method: string, ...args: any[]): void {
const top = this.getStackTop();
Expand All @@ -52,7 +52,7 @@ export class Hub {
* exists.
*
* @param method The method to call on the client/client.
* @param args Arguments to pass to the client/fontend.
* @param args Arguments to pass to the client/frontend.
*/
private invokeClientAsync(method: string, ...args: any[]): void {
const top = this.getStackTop();
Expand Down
34 changes: 17 additions & 17 deletions packages/node/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ describe('SentryNode', () => {
});

test('capture an exception', done => {
expect.assertions(6);
getDefaultHub().pushScope();
getDefaultHub().bindClient(
new NodeClient({
Expand Down Expand Up @@ -145,6 +146,7 @@ describe('SentryNode', () => {
});

test('capture a message', done => {
expect.assertions(2);
getDefaultHub().pushScope();
getDefaultHub().bindClient(
new NodeClient({
Expand All @@ -161,6 +163,7 @@ describe('SentryNode', () => {
});

test('capture an event', done => {
expect.assertions(2);
getDefaultHub().pushScope();
getDefaultHub().bindClient(
new NodeClient({
Expand All @@ -176,26 +179,23 @@ describe('SentryNode', () => {
getDefaultHub().popScope();
});

test('capture an event in a domain', async () => {
test('capture an event in a domain', async () =>
new Promise<void>(resolve => {
const d = domain.create();
const client = new NodeClient({
afterSend: (event: SentryEvent) => {
expect(event.message).toBe('test');
expect(event.exception).toBeUndefined();
resolve();
d.exit();
},
dsn,
});
d.run(() => {
getDefaultHub().pushScope();
getDefaultHub().bindClient(
new NodeClient({
afterSend: (event: SentryEvent) => {
expect(event.message).toBe('test');
expect(event.exception).toBeUndefined();
resolve();
d.exit();
},
dsn,
}),
);
captureEvent({ message: 'test' });
getDefaultHub().popScope();
getDefaultHub().bindClient(client);
expect(getDefaultHub().getClient()).toBe(client);
getDefaultHub().captureEvent({ message: 'test' });
});
});
});
}));
});
});

0 comments on commit 5601a14

Please sign in to comment.