Skip to content

ref(gatsby): Remove default Gatsby SDK options #4049

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 3 commits into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/gatsby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"@sentry-internal/eslint-config-sdk": "6.13.2",
"@sentry/types": "6.13.2",
"@testing-library/react": "^10.4.9",
"@types/node": "^16.10.3",
"jest": "^24.7.1",
"npm-run-all": "^4.1.2",
"prettier": "1.19.0",
Expand Down
6 changes: 0 additions & 6 deletions packages/gatsby/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ import { init as reactInit, SDK_VERSION } from '@sentry/react';
import { getIntegrationsFromOptions } from './utils/integrations';
import { GatsbyOptions } from './utils/types';

export const defaultOptions = {
autoSessionTracking: true,
environment: process.env.NODE_ENV || 'development',
};

/**
* Inits the Sentry Gatsby SDK.
*/
Expand All @@ -26,7 +21,6 @@ export function init(options: GatsbyOptions): void {

const integrations = getIntegrationsFromOptions(options);
reactInit({
...defaultOptions,
...options,
integrations,
});
Expand Down
15 changes: 4 additions & 11 deletions packages/gatsby/test/sdk.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { init as reactInitRaw, SDK_VERSION } from '@sentry/react';
import { Integrations } from '@sentry/tracing';
import { Integration, Package } from '@sentry/types';
import { Integration } from '@sentry/types';

import { defaultOptions, init as gatsbyInit } from '../src/sdk';
import { init as gatsbyInit } from '../src/sdk';
import { UserIntegrations } from '../src/utils/integrations';
import { GatsbyOptions } from '../src/utils/types';

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

test('Default init props', () => {
gatsbyInit({});
expect(reactInit).toHaveBeenCalledTimes(1);
const calledWith = reactInit.mock.calls[0][0];
expect(calledWith).toMatchObject(defaultOptions);
});

test('Has correct SDK metadata', () => {
gatsbyInit({});
const calledWith = reactInit.mock.calls[0][0];
Expand All @@ -36,11 +29,11 @@ describe('Initialize React SDK', () => {
});

describe('Environment', () => {
test('process.env', () => {
test('not defined by default', () => {
gatsbyInit({});
expect(reactInit).toHaveBeenCalledTimes(1);
const callingObject = reactInit.mock.calls[0][0];
expect(callingObject.environment).toStrictEqual('test');
expect(callingObject.environment).not.toBeDefined();
});

test('defined in the options', () => {
Expand Down
47 changes: 7 additions & 40 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2862,6 +2862,11 @@
progress "^2.0.3"
proxy-from-env "^1.1.0"

"@sentry/[email protected]":
version "6.13.2"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.13.2.tgz#8388d5b92ea8608936e7aae842801dc90e0184e6"
integrity sha512-6WjGj/VjjN8LZDtqJH5ikeB1o39rO1gYS6anBxiS3d0sXNBb3Ux0pNNDFoBxQpOhmdDHXYS57MEptX9EV82gmg==

"@sentry/[email protected]":
version "1.17.3"
resolved "https://registry.yarnpkg.com/@sentry/webpack-plugin/-/webpack-plugin-1.17.3.tgz#464a975c5d940d37c83cf1bc38d6491ee3872e9b"
Expand Down Expand Up @@ -3502,11 +3507,6 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.48.tgz#46a3df718aed5217277f2395a682e055a487e341"
integrity sha512-z8wvSsgWQzkr4sVuMEEOvwMdOQjiRY2Y/ZW4fDfjfe3+TfQrZqFKOthBgk2RnVEmtOKrkwdZ7uTvsxTBLjKGDQ==

"@types/node@^16.10.3":
version "16.10.3"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.10.3.tgz#7a8f2838603ea314d1d22bb3171d899e15c57bd5"
integrity sha512-ho3Ruq+fFnBrZhUYI46n/bV2GjwzSkwuT4dTf0GkuNFmnb8nq4ny2z9JEVemFi6bdEJanHLlYfy9c6FN9B9McQ==

"@types/node@~10.17.0":
version "10.17.56"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.56.tgz#010c9e047c3ff09ddcd11cbb6cf5912725cdc2b3"
Expand Down Expand Up @@ -4312,32 +4312,11 @@ [email protected]:
resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f"
integrity sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=

agent-base@4, agent-base@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee"
integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==
dependencies:
es6-promisify "^5.0.0"

agent-base@5:
agent-base@4, agent-base@5, agent-base@6, agent-base@^4.3.0, agent-base@~4.2.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-5.1.1.tgz#e8fb3f242959db44d63be665db7a8e739537a32c"
integrity sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==

agent-base@6:
version "6.0.2"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77"
integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==
dependencies:
debug "4"

agent-base@~4.2.1:
version "4.2.1"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9"
integrity sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==
dependencies:
es6-promisify "^5.0.0"

agentkeepalive@^3.4.1:
version "3.5.2"
resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-3.5.2.tgz#a113924dd3fa24a0bc3b78108c450c2abee00f67"
Expand Down Expand Up @@ -9615,18 +9594,6 @@ es6-object-assign@^1.1.0:
resolved "https://registry.yarnpkg.com/es6-object-assign/-/es6-object-assign-1.1.0.tgz#c2c3582656247c39ea107cb1e6652b6f9f24523c"
integrity sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=

es6-promise@^4.0.3:
version "4.2.8"
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a"
integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==

es6-promisify@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=
dependencies:
es6-promise "^4.0.3"

escalade@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"
Expand Down Expand Up @@ -13052,7 +13019,7 @@ jest-environment-jsdom@^24.9.0:
jest-util "^24.9.0"
jsdom "^11.5.1"

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