|
1 | 1 | /* eslint-disable @typescript-eslint/unbound-method */ |
2 | 2 | import { BrowserClient } from '@sentry/browser'; |
3 | | -import * as hubModuleRaw from '@sentry/hub'; // for mocking |
4 | 3 | import { getMainCarrier, Hub } from '@sentry/hub'; |
5 | 4 | import * as utilsModule from '@sentry/utils'; // for mocking |
6 | 5 | import { getGlobalObject, isNodeEnv, logger } from '@sentry/utils'; |
7 | 6 | import * as nodeHttpModule from 'http'; |
8 | 7 |
|
9 | 8 | import { addExtensionMethods } from '../src/hubextensions'; |
10 | 9 |
|
11 | | -// Do this once so that we'll be able to spy on hub methods later. If this isn't done, it results in "TypeError: Cannot |
12 | | -// set property <methodYouWantToSpyOn> of #<Object> which has only a getter." This just converts the module object |
13 | | -// (which has no setters) to a regular object (with regular properties which can be gotten or set). See |
14 | | -// https://stackoverflow.com/a/53307822/. |
15 | | - |
16 | | -// (This doesn't affect the utils module because it uses `export * from './myModule' syntax rather than `export |
17 | | -// {<individually named methods>} from './myModule'` syntax in its index.ts. Only *named* exports seem to trigger the |
18 | | -// problem.) |
19 | | -const hubModule = { ...hubModuleRaw }; |
20 | | - |
21 | 10 | addExtensionMethods(); |
22 | 11 |
|
23 | 12 | describe('Hub', () => { |
24 | 13 | beforeEach(() => { |
25 | 14 | jest.spyOn(logger, 'warn'); |
26 | 15 | jest.spyOn(logger, 'log'); |
27 | 16 | jest.spyOn(utilsModule, 'isNodeEnv'); |
28 | | - |
29 | | - // NB: Upon refactoring, this spy was no longer needed. Leaving it in as an excuse to leave in the note above, so |
30 | | - // that it can save future folks the headache. |
31 | | - jest.spyOn(hubModule, 'getActiveDomain'); |
32 | 17 | }); |
33 | 18 |
|
34 | 19 | afterEach(() => { |
|
0 commit comments