Skip to content

Commit df5667a

Browse files
committed
remove hasSentryCode check && adjust tests
1 parent 78beffa commit df5667a

File tree

2 files changed

+1
-16
lines changed

2 files changed

+1
-16
lines changed

packages/sveltekit/src/vite/autoInstrument.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,6 @@ export async function canWrapLoad(id: string, debug: boolean): Promise<boolean>
9393
const code = (await fs.promises.readFile(id, 'utf8')).toString();
9494
const mod = parseModule(code);
9595

96-
const hasSentryContent = mod.imports.$items.find(importExpression => importExpression.from === '@sentry/sveltekit');
97-
if (hasSentryContent) {
98-
// eslint-disable-next-line no-console
99-
debug && console.log(`Skipping wrapping ${id} because it already contains Sentry code`);
100-
return false;
101-
}
102-
10396
const program = mod.$ast.type === 'Program' && mod.$ast;
10497
if (!program) {
10598
// eslint-disable-next-line no-console

packages/sveltekit/test/vite/autoInstrument.test.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ describe('canWrapLoad', () => {
188188
`import type { LayoutLoad } from './$types';
189189
export const load : LayoutLoad = async () => { return { props: { msg: "hi" } } }`,
190190
],
191-
])('returns `true` if a load declaration (%s) exists and no Sentry code was found', async (_, code) => {
191+
])('returns `true` if a load declaration (%s) exists', async (_, code) => {
192192
fileContent = code;
193193
expect(await canWrapLoad('+page.ts', false)).toEqual(true);
194194
});
@@ -209,12 +209,4 @@ describe('canWrapLoad', () => {
209209
fileContent = code;
210210
expect(await canWrapLoad('+page.ts', false)).toEqual(true);
211211
});
212-
213-
it.each([
214-
'import * as Sentry from "@sentry/sveltekit"; export const prerender = true;',
215-
'export const a = 1; import { init } from "@sentry/sveltekit"; export const load = () => {}',
216-
])('returns `false` if Sentry code was found', async code => {
217-
fileContent = code;
218-
expect(await canWrapLoad('+page.ts', false)).toEqual(false);
219-
});
220212
});

0 commit comments

Comments
 (0)