sentry-removal.test.mjs
1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import assert from 'node:assert/strict'
import { access, readFile } from 'node:fs/promises'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { describe, it } from 'node:test'
const projectRoot = path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
'../..'
)
describe('Sentry removal boundary', () => {
it('ships no Sentry SDK, bootstrap, DSN, or runtime reporter calls', async () => {
const removedArtifacts = [
'utils/lib/sentry-miniapp.js',
'utils/sentryConfig/sentryInit.js'
]
for (const relativePath of removedArtifacts) {
await assert.rejects(
access(path.join(projectRoot, relativePath)),
error => error?.code === 'ENOENT',
`Sentry artifact must not ship: ${relativePath}`
)
}
const runtimeFiles = [
'app.js',
'config.js',
'packageStudy/pages/aiCheck/chat/chat.js',
'packageStudy/pages/aiCheck/components/SpeechPopup/SpeechPopup.js'
]
const runtimeSource = (
await Promise.all(
runtimeFiles.map(relativePath =>
readFile(path.join(projectRoot, relativePath), 'utf8')
)
)
).join('\n')
assert.doesNotMatch(runtimeSource, /sentry|\$sendSentry|dsnUrl/i)
})
})