Skip to content

Commit faf6717

Browse files
ref(gatsby): Remove default Gatsby SDK options (#4049)
Removing the two Gatsby SDK default options because: - `autoSessionTracking` is redundant, enabled by default since `v6`. - `environment` should be `undefined` if not set by the user.
1 parent 223d330 commit faf6717

File tree

4 files changed

+11
-58
lines changed

4 files changed

+11
-58
lines changed

packages/gatsby/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
"@sentry-internal/eslint-config-sdk": "6.13.2",
3737
"@sentry/types": "6.13.2",
3838
"@testing-library/react": "^10.4.9",
39-
"@types/node": "^16.10.3",
4039
"jest": "^24.7.1",
4140
"npm-run-all": "^4.1.2",
4241
"prettier": "1.19.0",

packages/gatsby/src/sdk.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ import { init as reactInit, SDK_VERSION } from '@sentry/react';
33
import { getIntegrationsFromOptions } from './utils/integrations';
44
import { GatsbyOptions } from './utils/types';
55

6-
export const defaultOptions = {
7-
autoSessionTracking: true,
8-
environment: process.env.NODE_ENV || 'development',
9-
};
10-
116
/**
127
* Inits the Sentry Gatsby SDK.
138
*/
@@ -26,7 +21,6 @@ export function init(options: GatsbyOptions): void {
2621

2722
const integrations = getIntegrationsFromOptions(options);
2823
reactInit({
29-
...defaultOptions,
3024
...options,
3125
integrations,
3226
});

packages/gatsby/test/sdk.test.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { init as reactInitRaw, SDK_VERSION } from '@sentry/react';
22
import { Integrations } from '@sentry/tracing';
3-
import { Integration, Package } from '@sentry/types';
3+
import { Integration } from '@sentry/types';
44

5-
import { defaultOptions, init as gatsbyInit } from '../src/sdk';
5+
import { init as gatsbyInit } from '../src/sdk';
66
import { UserIntegrations } from '../src/utils/integrations';
77
import { GatsbyOptions } from '../src/utils/types';
88

@@ -12,13 +12,6 @@ jest.mock('@sentry/react');
1212
describe('Initialize React SDK', () => {
1313
afterEach(() => reactInit.mockReset());
1414

15-
test('Default init props', () => {
16-
gatsbyInit({});
17-
expect(reactInit).toHaveBeenCalledTimes(1);
18-
const calledWith = reactInit.mock.calls[0][0];
19-
expect(calledWith).toMatchObject(defaultOptions);
20-
});
21-
2215
test('Has correct SDK metadata', () => {
2316
gatsbyInit({});
2417
const calledWith = reactInit.mock.calls[0][0];
@@ -36,11 +29,11 @@ describe('Initialize React SDK', () => {
3629
});
3730

3831
describe('Environment', () => {
39-
test('process.env', () => {
32+
test('not defined by default', () => {
4033
gatsbyInit({});
4134
expect(reactInit).toHaveBeenCalledTimes(1);
4235
const callingObject = reactInit.mock.calls[0][0];
43-
expect(callingObject.environment).toStrictEqual('test');
36+
expect(callingObject.environment).not.toBeDefined();
4437
});
4538

4639
test('defined in the options', () => {

yarn.lock

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2862,6 +2862,11 @@
28622862
progress "^2.0.3"
28632863
proxy-from-env "^1.1.0"
28642864

2865+
2866+
version "6.13.2"
2867+
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.13.2.tgz#8388d5b92ea8608936e7aae842801dc90e0184e6"
2868+
integrity sha512-6WjGj/VjjN8LZDtqJH5ikeB1o39rO1gYS6anBxiS3d0sXNBb3Ux0pNNDFoBxQpOhmdDHXYS57MEptX9EV82gmg==
2869+
28652870
28662871
version "1.17.3"
28672872
resolved "https://registry.yarnpkg.com/@sentry/webpack-plugin/-/webpack-plugin-1.17.3.tgz#464a975c5d940d37c83cf1bc38d6491ee3872e9b"
@@ -3502,11 +3507,6 @@
35023507
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.48.tgz#46a3df718aed5217277f2395a682e055a487e341"
35033508
integrity sha512-z8wvSsgWQzkr4sVuMEEOvwMdOQjiRY2Y/ZW4fDfjfe3+TfQrZqFKOthBgk2RnVEmtOKrkwdZ7uTvsxTBLjKGDQ==
35043509

3505-
"@types/node@^16.10.3":
3506-
version "16.10.3"
3507-
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.10.3.tgz#7a8f2838603ea314d1d22bb3171d899e15c57bd5"
3508-
integrity sha512-ho3Ruq+fFnBrZhUYI46n/bV2GjwzSkwuT4dTf0GkuNFmnb8nq4ny2z9JEVemFi6bdEJanHLlYfy9c6FN9B9McQ==
3509-
35103510
"@types/node@~10.17.0":
35113511
version "10.17.56"
35123512
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.56.tgz#010c9e047c3ff09ddcd11cbb6cf5912725cdc2b3"
@@ -4312,32 +4312,11 @@ [email protected]:
43124312
resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f"
43134313
integrity sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=
43144314

4315-
agent-base@4, agent-base@^4.3.0:
4316-
version "4.3.0"
4317-
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee"
4318-
integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==
4319-
dependencies:
4320-
es6-promisify "^5.0.0"
4321-
4322-
agent-base@5:
4315+
agent-base@4, agent-base@5, agent-base@6, agent-base@^4.3.0, agent-base@~4.2.1:
43234316
version "5.1.1"
43244317
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-5.1.1.tgz#e8fb3f242959db44d63be665db7a8e739537a32c"
43254318
integrity sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==
43264319

4327-
agent-base@6:
4328-
version "6.0.2"
4329-
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77"
4330-
integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==
4331-
dependencies:
4332-
debug "4"
4333-
4334-
agent-base@~4.2.1:
4335-
version "4.2.1"
4336-
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9"
4337-
integrity sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==
4338-
dependencies:
4339-
es6-promisify "^5.0.0"
4340-
43414320
agentkeepalive@^3.4.1:
43424321
version "3.5.2"
43434322
resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-3.5.2.tgz#a113924dd3fa24a0bc3b78108c450c2abee00f67"
@@ -9615,18 +9594,6 @@ es6-object-assign@^1.1.0:
96159594
resolved "https://registry.yarnpkg.com/es6-object-assign/-/es6-object-assign-1.1.0.tgz#c2c3582656247c39ea107cb1e6652b6f9f24523c"
96169595
integrity sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=
96179596

9618-
es6-promise@^4.0.3:
9619-
version "4.2.8"
9620-
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a"
9621-
integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==
9622-
9623-
es6-promisify@^5.0.0:
9624-
version "5.0.0"
9625-
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
9626-
integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=
9627-
dependencies:
9628-
es6-promise "^4.0.3"
9629-
96309597
escalade@^3.1.1:
96319598
version "3.1.1"
96329599
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"
@@ -13052,7 +13019,7 @@ jest-environment-jsdom@^24.9.0:
1305213019
jest-util "^24.9.0"
1305313020
jsdom "^11.5.1"
1305413021

13055-
"jest-environment-node@>=24 <=26", jest-environment-node@^24.9.0:
13022+
jest-environment-node@24, "jest-environment-node@>=24 <=26", jest-environment-node@^24.9.0:
1305613023
version "24.9.0"
1305713024
resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.9.0.tgz#333d2d2796f9687f2aeebf0742b519f33c1cbfd3"
1305813025
integrity sha512-6d4V2f4nxzIzwendo27Tr0aFm+IXWa0XEUnaH6nU0FMaozxovt+sfRvh4J47wL1OvF83I3SSTu0XK+i4Bqe7uA==

0 commit comments

Comments
 (0)