-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ref(tracing): Make tracing integrations tree shakeable #4204
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
Changes from all commits
d8101c0
8adf3ec
71116cc
39b5a75
2cafb72
246ea11
32840bc
fc33c16
fd6c608
0a5363b
8a2699f
34d8376
751e054
e50a43f
65b40d9
9339101
fff4241
04dcc80
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
import { Integrations } from '../src/index.bundle'; | ||
import { testOnlyIfNodeVersionAtLeast } from './testutils'; | ||
|
||
describe('Integrations export', () => { | ||
// TODO `Object.values` doesn't work on Node < 8 | ||
testOnlyIfNodeVersionAtLeast(8)('is exported correctly', () => { | ||
Object.values(Integrations).forEach(integration => { | ||
expect(integration.id).toStrictEqual(expect.any(String)); | ||
it('is exported correctly', () => { | ||
Object.keys(Integrations).forEach(key => { | ||
expect(Integrations[key as keyof typeof Integrations].id).toStrictEqual(expect.any(String)); | ||
Comment on lines
+4
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In both its old and new versions, I find this test confusing. How does the fact that every value in the (Also, what's the advantage of the refactor here?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just made it so that we don't need to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah good question on the value of this test. I just copied the existing one from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I figured that might be the case. My thought about that, though, is that if you leave aside the node restriction, IMHO the old test is simpler, because you don't need the keyof typeof stuff, and since we're about to drop node 6 compatibility anyway, we could just remove the wrapper when we do and still get to have a simpler test. What do you think? That said, yeah, first we have to figure out if we even want the test in the first place! My issue with it is less "is there value in testing the exportation?" (though I'm iffy on that) and more "okay, but how does any of this prove that it's exported correctly?". Do you understand the logic there? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I will come back to this and address this in another PR. You make great points that we have to figure out. |
||
}); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { getCurrentHub } from '@sentry/hub'; | ||
|
||
import { BrowserTracing, Integrations } from '../src'; | ||
|
||
describe('index', () => { | ||
it('patches the global hub to add an implementation for `Hub.startTransaction` as a side effect', () => { | ||
const hub = getCurrentHub(); | ||
const transaction = hub.startTransaction({ name: 'test', endTimestamp: 123 }); | ||
expect(transaction).toBeDefined(); | ||
}); | ||
|
||
describe('Integrations', () => { | ||
it('is exported correctly', () => { | ||
Object.keys(Integrations).forEach(key => { | ||
expect(Integrations[key as keyof typeof Integrations].id).toStrictEqual(expect.any(String)); | ||
}); | ||
}); | ||
|
||
it('contains BrowserTracing', () => { | ||
expect(Integrations.BrowserTracing).toEqual(BrowserTracing); | ||
}); | ||
}); | ||
}); |
Uh oh!
There was an error while loading. Please reload this page.