Skip to content

Commit 06ea035

Browse files
committed
add beforeAll and afterAll
1 parent 3bdd4fc commit 06ea035

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packages/tracing-internal/test/browser/metrics/index.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ const mockWindowLocation = {
1616
hash: ""
1717
} as Window['location'];
1818

19-
WINDOW.location = mockWindowLocation;
20-
19+
const originalWindowLocation = WINDOW.location;
2120
const resourceEntryName = 'https://example.com/assets/to/css';
2221

2322
describe('_addMeasureSpans', () => {
2423
// eslint-disable-next-line deprecation/deprecation
2524
const transaction = new Transaction({ op: 'pageload', name: '/' });
25+
2626
beforeEach(() => {
2727
// eslint-disable-next-line deprecation/deprecation
2828
transaction.startChild = jest.fn();
@@ -60,6 +60,15 @@ describe('_addMeasureSpans', () => {
6060
describe('_addResourceSpans', () => {
6161
// eslint-disable-next-line deprecation/deprecation
6262
const transaction = new Transaction({ op: 'pageload', name: '/' });
63+
64+
beforeAll(() => {
65+
WINDOW.location = mockWindowLocation;
66+
})
67+
68+
afterAll(() => {
69+
WINDOW.location = originalWindowLocation;
70+
})
71+
6372
beforeEach(() => {
6473
// eslint-disable-next-line deprecation/deprecation
6574
transaction.startChild = jest.fn();

0 commit comments

Comments
 (0)