Skip to content

Commit

Permalink
chore(lint): Allow ts-ignore in Node integration tests (#13254)
Browse files Browse the repository at this point in the history
Discovered today that TS 3.8 doesn't understand `// @ts-expect-error`.
Since we test on Node 22 also with TS 3.8, we shouldn't use
`ts-expect-error` in test files as TS 3.8 would simply ignore the
comment and throw a type error.

Instead, it's fine to use `@ts-ignore` in these test files.
  • Loading branch information
Lms24 authored Aug 6, 2024
1 parent 8fb3f24 commit 69d4823
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 9 additions & 0 deletions dev-packages/node-integration-tests/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ module.exports = {
},
rules: {
'@typescript-eslint/typedef': 'off',
// Explicitly allow ts-ignore with description for Node integration tests
// Reason: We run these tests on TS3.8 which doesn't support `@ts-expect-error`
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description',
'ts-expect-error': true,
},
],
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ describe('getTraceMetaTags', () => {
baggage: 'sentry-environment=production',
});

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-ignore - response is defined, types just don't reflect it
const html = response?.response as unknown as string;

expect(html).toMatch(/<meta name="sentry-trace" content="cd7ee7a6fe3ebe7ab9c3271559bc203c-[a-z0-9]{16}-1"\/>/);
Expand Down

0 comments on commit 69d4823

Please sign in to comment.