Skip to content

Commit f4ac5f8

Browse files
committed
remove note about weird mocking hack
1 parent 8c6667b commit f4ac5f8

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

packages/tracing/test/hub.test.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,19 @@
11
/* eslint-disable @typescript-eslint/unbound-method */
22
import { BrowserClient } from '@sentry/browser';
3-
import * as hubModuleRaw from '@sentry/hub'; // for mocking
43
import { getMainCarrier, Hub } from '@sentry/hub';
54
import * as utilsModule from '@sentry/utils'; // for mocking
65
import { getGlobalObject, isNodeEnv, logger } from '@sentry/utils';
76
import * as nodeHttpModule from 'http';
87

98
import { addExtensionMethods } from '../src/hubextensions';
109

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-
2110
addExtensionMethods();
2211

2312
describe('Hub', () => {
2413
beforeEach(() => {
2514
jest.spyOn(logger, 'warn');
2615
jest.spyOn(logger, 'log');
2716
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');
3217
});
3318

3419
afterEach(() => {

0 commit comments

Comments
 (0)