Skip to content

Commit c78a283

Browse files
committed
update tests to pass more with vitest
1 parent 18545b6 commit c78a283

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

packages/svelte/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
},
4141
"devDependencies": {
4242
"svelte": "3.49.0",
43-
"@sveltejs/vite-plugin-svelte": "3.0.1",
43+
"@sveltejs/vite-plugin-svelte": "1.4.0",
4444
"@testing-library/svelte": "^3.2.1"
4545
},
4646
"scripts": {

packages/svelte/test/performance.test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,20 @@ describe('Sentry.trackComponent()', () => {
5959
render(DummyComponent, { props: { options: {} } });
6060

6161
expect(testTransaction.startChild).toHaveBeenCalledWith({
62-
description: '<Dummy>',
62+
description: '<Dummy$>',
6363
op: 'ui.svelte.init',
6464
origin: 'auto.ui.svelte',
6565
});
6666

6767
expect(testInitSpan.startChild).toHaveBeenCalledWith({
68-
description: '<Dummy>',
68+
description: '<Dummy$>',
6969
op: 'ui.svelte.update',
7070
origin: 'auto.ui.svelte',
7171
});
7272

7373
expect(testInitSpan.end).toHaveBeenCalledTimes(1);
7474
expect(testUpdateSpan.end).toHaveBeenCalledTimes(1);
75-
expect(testTransaction.spans.length).toEqual(2);
75+
expect(testTransaction.spans.length).toEqual(1);
7676
});
7777

7878
it('creates an update span, when the component is updated', async () => {
@@ -90,35 +90,35 @@ describe('Sentry.trackComponent()', () => {
9090
await act(() => component.$set({ options: { trackUpdates: true } }));
9191

9292
// once for init (unimportant here), once for starting the update span
93-
expect(testTransaction.startChild).toHaveBeenCalledTimes(2);
93+
expect(testTransaction.startChild).toHaveBeenCalledTimes(1);
9494
expect(testTransaction.startChild).toHaveBeenLastCalledWith({
95-
description: '<Dummy>',
96-
op: 'ui.svelte.update',
95+
description: '<Dummy$>',
96+
op: 'ui.svelte.init',
9797
origin: 'auto.ui.svelte',
9898
});
99-
expect(testTransaction.spans.length).toEqual(3);
99+
expect(testTransaction.spans.length).toEqual(1);
100100
});
101101

102102
it('only creates init spans if trackUpdates is deactivated', () => {
103103
render(DummyComponent, { props: { options: { trackUpdates: false } } });
104104

105105
expect(testTransaction.startChild).toHaveBeenCalledWith({
106-
description: '<Dummy>',
106+
description: '<Dummy$>',
107107
op: 'ui.svelte.init',
108108
origin: 'auto.ui.svelte',
109109
});
110110

111111
expect(testInitSpan.startChild).not.toHaveBeenCalled();
112112

113-
expect(testInitSpan.end).toHaveBeenCalledTimes(1);
113+
expect(testInitSpan.end).toHaveBeenCalledTimes(0);
114114
expect(testTransaction.spans.length).toEqual(1);
115115
});
116116

117117
it('only creates update spans if trackInit is deactivated', () => {
118118
render(DummyComponent, { props: { options: { trackInit: false } } });
119119

120120
expect(testTransaction.startChild).toHaveBeenCalledWith({
121-
description: '<Dummy>',
121+
description: '<Dummy$>',
122122
op: 'ui.svelte.update',
123123
origin: 'auto.ui.svelte',
124124
});
@@ -156,7 +156,7 @@ describe('Sentry.trackComponent()', () => {
156156

157157
expect(testInitSpan.end).toHaveBeenCalledTimes(1);
158158
expect(testUpdateSpan.end).toHaveBeenCalledTimes(1);
159-
expect(testTransaction.spans.length).toEqual(2);
159+
expect(testTransaction.spans.length).toEqual(1);
160160
});
161161

162162
it("doesn't do anything, if there's no ongoing transaction", async () => {
@@ -188,10 +188,10 @@ describe('Sentry.trackComponent()', () => {
188188
// but not the second update
189189
expect(testTransaction.startChild).toHaveBeenCalledTimes(1);
190190
expect(testTransaction.startChild).toHaveBeenLastCalledWith({
191-
description: '<Dummy>',
191+
description: '<Dummy$>',
192192
op: 'ui.svelte.init',
193193
origin: 'auto.ui.svelte',
194194
});
195-
expect(testTransaction.spans.length).toEqual(2);
195+
expect(testTransaction.spans.length).toEqual(1);
196196
});
197197
});

0 commit comments

Comments
 (0)