Skip to content

chore(various): Fix typos and other tiny problems #3226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 2, 2021
11 changes: 10 additions & 1 deletion packages/core/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,20 @@ const SENTRY_API_VERSION = '7';
* Supports both envelopes and regular event requests.
**/
export class API {
/** The DSN as passed to Sentry.init() */
public dsn: DsnLike;

/** Metadata about the SDK (name, version, etc) for inclusion in envelope headers */
public metadata: SdkMetadata;

/** The internally used Dsn object. */
private readonly _dsnObject: Dsn;

/** Create a new instance of API */
public constructor(public dsn: DsnLike, public metadata: SdkMetadata = {}) {
public constructor(dsn: DsnLike, metadata: SdkMetadata = {}) {
this.dsn = dsn;
this._dsnObject = new Dsn(dsn);
this.metadata = metadata;
}

/** Returns the Dsn object. */
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/baseclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { IntegrationIndex, setupIntegrations } from './integration';
* without a valid Dsn, the SDK will not send any events to Sentry.
*
* Before sending an event via the backend, it is passed through
* {@link BaseClient.prepareEvent} to add SDK information and scope data
* {@link BaseClient._prepareEvent} to add SDK information and scope data
* (breadcrumbs and context). To add more custom information, override this
* method and extend the resulting prepared event.
*
Expand Down Expand Up @@ -428,7 +428,7 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement

/**
* This function adds all used integrations to the SDK info in the event.
* @param sdkInfo The sdkInfo of the event that will be filled with all integrations.
* @param event The event that will be filled with all integrations.
*/
protected _applyIntegrationsMetadata(event: Event): void {
const sdkInfo = event.sdk;
Expand Down
1 change: 1 addition & 0 deletions packages/hub/src/hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ export function getHubFromCarrier(carrier: Carrier): Hub {
* This will set passed {@link Hub} on the passed object's __SENTRY__.hub attribute
* @param carrier object
* @param hub Hub
* @returns A boolean indicating success or failure
*/
export function setHubOnCarrier(carrier: Carrier, hub: Hub): boolean {
if (!carrier) return false;
Expand Down
4 changes: 2 additions & 2 deletions packages/node/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('SentryNode', () => {
});

afterEach(() => {
s.mockReset();
s.mockRestore();
});

test('record auto breadcrumbs', done => {
Expand Down Expand Up @@ -98,7 +98,7 @@ describe('SentryNode', () => {
});

afterEach(() => {
s.mockReset();
s.mockRestore();
});

test('capture an exception', done => {
Expand Down
2 changes: 2 additions & 0 deletions packages/serverless/src/gcpfunction/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,5 @@ export function configureScopeWithContext(scope: Scope, context: Context): void
scope.setTag('server_name', process.env.SENTRY_NAME || hostname());
scope.setContext('gcp.function.context', { ...context } as SentryContext);
}

export { Request, Response };
2 changes: 1 addition & 1 deletion packages/serverless/test/awsservices.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('AWSServices', () => {
nock.restore();
});

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

test('getObject', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/serverless/test/google-cloud-grpc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function mockHttp2Session(): FakeSession {
return session;
}

describe('GoogleCloudGrpc', () => {
describe('GoogleCloudGrpc tracing', () => {
beforeAll(() => {
new GoogleCloudGrpc().setupOnce();
});
Expand Down
2 changes: 1 addition & 1 deletion packages/serverless/test/google-cloud-http.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { GoogleCloudHttp } from '../src/google-cloud-http';
* Thanks to this, we don't have to do more magic than necessary. Just add and export desired method and assert on it.
*/

describe('GoogleCloudHttp', () => {
describe('GoogleCloudHttp tracing', () => {
beforeAll(() => {
new GoogleCloudHttp().setupOnce();
});
Expand Down
2 changes: 1 addition & 1 deletion packages/tracing/src/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class Transaction extends SpanClass implements TransactionInterface {
this._hub = hub as Hub;
}

this.name = transactionContext.name ? transactionContext.name : '';
this.name = transactionContext.name || '';

this._trimEnd = transactionContext.trimEnd;

Expand Down
11 changes: 6 additions & 5 deletions packages/tracing/test/browser/browsertracing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jest.mock('@sentry/utils', () => {
...actual,
addInstrumentationHandler: ({ callback, type }: any): void => {
if (type === 'history') {
// rather than actually add the navigation-change handler, grab a reference to it, so we can trigger it manually
mockChangeHistory = callback;
}
},
Expand Down Expand Up @@ -64,17 +65,17 @@ describe('BrowserTracing', () => {
});

function createBrowserTracing(setup?: boolean, _options?: Partial<BrowserTracingOptions>): BrowserTracing {
const inst = new BrowserTracing(_options);
const instance = new BrowserTracing(_options);
if (setup) {
const processor = () => undefined;
inst.setupOnce(processor, () => hub);
instance.setupOnce(processor, () => hub);
}

return inst;
return instance;
}

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

Expand Down Expand Up @@ -126,7 +127,7 @@ describe('BrowserTracing', () => {
});

describe('tracingOrigins', () => {
it('warns and uses default tracing origins if non are provided', () => {
it('warns and uses default tracing origins if none are provided', () => {
const inst = createBrowserTracing(true, {
routingInstrumentation: customRoutingInstrumentation,
});
Expand Down
10 changes: 3 additions & 7 deletions packages/tracing/test/hub.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,17 @@ addExtensionMethods();

const mathRandom = jest.spyOn(Math, 'random');
jest.spyOn(Transaction.prototype, 'setMetadata');
jest.spyOn(logger, 'warn');
jest.spyOn(logger, 'log');
jest.spyOn(utilsModule, 'isNodeEnv');

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

describe('Hub', () => {
beforeEach(() => {
jest.spyOn(logger, 'warn');
jest.spyOn(logger, 'log');
jest.spyOn(utilsModule, 'isNodeEnv');
});

afterEach(() => {
jest.clearAllMocks();
jest.useRealTimers();
});

describe('getTransaction()', () => {
Expand Down