Skip to content

Commit 5f69a63

Browse files
authored
chore(various): Fix typos and other tiny problems (#3226)
No behavior changes.
1 parent 24d2b4b commit 5f69a63

File tree

11 files changed

+30
-21
lines changed

11 files changed

+30
-21
lines changed

packages/core/src/api.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,20 @@ const SENTRY_API_VERSION = '7';
99
* Supports both envelopes and regular event requests.
1010
**/
1111
export class API {
12+
/** The DSN as passed to Sentry.init() */
13+
public dsn: DsnLike;
14+
15+
/** Metadata about the SDK (name, version, etc) for inclusion in envelope headers */
16+
public metadata: SdkMetadata;
17+
1218
/** The internally used Dsn object. */
1319
private readonly _dsnObject: Dsn;
20+
1421
/** Create a new instance of API */
15-
public constructor(public dsn: DsnLike, public metadata: SdkMetadata = {}) {
22+
public constructor(dsn: DsnLike, metadata: SdkMetadata = {}) {
23+
this.dsn = dsn;
1624
this._dsnObject = new Dsn(dsn);
25+
this.metadata = metadata;
1726
}
1827

1928
/** Returns the Dsn object. */

packages/core/src/baseclient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import { IntegrationIndex, setupIntegrations } from './integration';
4040
* without a valid Dsn, the SDK will not send any events to Sentry.
4141
*
4242
* Before sending an event via the backend, it is passed through
43-
* {@link BaseClient.prepareEvent} to add SDK information and scope data
43+
* {@link BaseClient._prepareEvent} to add SDK information and scope data
4444
* (breadcrumbs and context). To add more custom information, override this
4545
* method and extend the resulting prepared event.
4646
*
@@ -428,7 +428,7 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
428428

429429
/**
430430
* This function adds all used integrations to the SDK info in the event.
431-
* @param sdkInfo The sdkInfo of the event that will be filled with all integrations.
431+
* @param event The event that will be filled with all integrations.
432432
*/
433433
protected _applyIntegrationsMetadata(event: Event): void {
434434
const sdkInfo = event.sdk;

packages/hub/src/hub.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ export function getHubFromCarrier(carrier: Carrier): Hub {
537537
* This will set passed {@link Hub} on the passed object's __SENTRY__.hub attribute
538538
* @param carrier object
539539
* @param hub Hub
540+
* @returns A boolean indicating success or failure
540541
*/
541542
export function setHubOnCarrier(carrier: Carrier, hub: Hub): boolean {
542543
if (!carrier) return false;

packages/node/test/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe('SentryNode', () => {
6969
});
7070

7171
afterEach(() => {
72-
s.mockReset();
72+
s.mockRestore();
7373
});
7474

7575
test('record auto breadcrumbs', done => {
@@ -98,7 +98,7 @@ describe('SentryNode', () => {
9898
});
9999

100100
afterEach(() => {
101-
s.mockReset();
101+
s.mockRestore();
102102
});
103103

104104
test('capture an exception', done => {

packages/serverless/src/gcpfunction/general.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,5 @@ export function configureScopeWithContext(scope: Scope, context: Context): void
6161
scope.setTag('server_name', process.env.SENTRY_NAME || hostname());
6262
scope.setContext('gcp.function.context', { ...context } as SentryContext);
6363
}
64+
65+
export { Request, Response };

packages/serverless/test/awsservices.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('AWSServices', () => {
2323
nock.restore();
2424
});
2525

26-
describe('S3', () => {
26+
describe('S3 tracing', () => {
2727
const s3 = new AWS.S3({ accessKeyId: '-', secretAccessKey: '-' });
2828

2929
test('getObject', async () => {

packages/serverless/test/google-cloud-grpc.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function mockHttp2Session(): FakeSession {
7676
return session;
7777
}
7878

79-
describe('GoogleCloudGrpc', () => {
79+
describe('GoogleCloudGrpc tracing', () => {
8080
beforeAll(() => {
8181
new GoogleCloudGrpc().setupOnce();
8282
});

packages/serverless/test/google-cloud-http.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { GoogleCloudHttp } from '../src/google-cloud-http';
1313
* Thanks to this, we don't have to do more magic than necessary. Just add and export desired method and assert on it.
1414
*/
1515

16-
describe('GoogleCloudHttp', () => {
16+
describe('GoogleCloudHttp tracing', () => {
1717
beforeAll(() => {
1818
new GoogleCloudHttp().setupOnce();
1919
});

packages/tracing/src/transaction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class Transaction extends SpanClass implements TransactionInterface {
3737
this._hub = hub as Hub;
3838
}
3939

40-
this.name = transactionContext.name ? transactionContext.name : '';
40+
this.name = transactionContext.name || '';
4141

4242
this._trimEnd = transactionContext.trimEnd;
4343

packages/tracing/test/browser/browsertracing.test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jest.mock('@sentry/utils', () => {
2525
...actual,
2626
addInstrumentationHandler: ({ callback, type }: any): void => {
2727
if (type === 'history') {
28+
// rather than actually add the navigation-change handler, grab a reference to it, so we can trigger it manually
2829
mockChangeHistory = callback;
2930
}
3031
},
@@ -64,17 +65,17 @@ describe('BrowserTracing', () => {
6465
});
6566

6667
function createBrowserTracing(setup?: boolean, _options?: Partial<BrowserTracingOptions>): BrowserTracing {
67-
const inst = new BrowserTracing(_options);
68+
const instance = new BrowserTracing(_options);
6869
if (setup) {
6970
const processor = () => undefined;
70-
inst.setupOnce(processor, () => hub);
71+
instance.setupOnce(processor, () => hub);
7172
}
7273

73-
return inst;
74+
return instance;
7475
}
7576

7677
// These are important enough to check with a test as incorrect defaults could
77-
// break a lot of users configurations.
78+
// break a lot of users' configurations.
7879
it('is created with default settings', () => {
7980
const browserTracing = createBrowserTracing();
8081

@@ -126,7 +127,7 @@ describe('BrowserTracing', () => {
126127
});
127128

128129
describe('tracingOrigins', () => {
129-
it('warns and uses default tracing origins if non are provided', () => {
130+
it('warns and uses default tracing origins if none are provided', () => {
130131
const inst = createBrowserTracing(true, {
131132
routingInstrumentation: customRoutingInstrumentation,
132133
});

packages/tracing/test/hub.test.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,17 @@ addExtensionMethods();
1616

1717
const mathRandom = jest.spyOn(Math, 'random');
1818
jest.spyOn(Transaction.prototype, 'setMetadata');
19+
jest.spyOn(logger, 'warn');
20+
jest.spyOn(logger, 'log');
21+
jest.spyOn(utilsModule, 'isNodeEnv');
1922

2023
// we have to add things into the real global object (rather than mocking the return value of getGlobalObject) because
2124
// there are modules which call getGlobalObject as they load, which is seemingly too early for jest to intervene
2225
addDOMPropertiesToGlobal(['XMLHttpRequest', 'Event', 'location', 'document']);
2326

2427
describe('Hub', () => {
25-
beforeEach(() => {
26-
jest.spyOn(logger, 'warn');
27-
jest.spyOn(logger, 'log');
28-
jest.spyOn(utilsModule, 'isNodeEnv');
29-
});
30-
3128
afterEach(() => {
3229
jest.clearAllMocks();
33-
jest.useRealTimers();
3430
});
3531

3632
describe('getTransaction()', () => {

0 commit comments

Comments
 (0)