Files
next.js/test/production/remove-unused-imports/remove-unused-imports.test.ts
Zack TannerandGitHub e296bcb812 [tests]: remove unnecessary skipDeployment flags (#92423)
These tests won't ever be run in a deployed environment, so this removes
`skipDeployment` so it's easier to grok which tests are intentionally
disabled because they don't work when deployed.
2026-04-06 14:30:07 -07:00

33 lines
776 B
TypeScript

import { nextTestSetup } from 'e2e-utils'
describe('remove-unused-imports', () => {
const { next, skipped } = nextTestSetup({
files: __dirname,
})
if (skipped) {
return
}
it('should remove unused imports', async () => {
const browser = await next.browser('/')
let scripts = await browser.elementsByCss('script[src]')
expect(
(
await Promise.all(
scripts.map(async (el) => {
const src = await el.getAttribute('src')
const res = await next.fetch(src)
const code = await res.text()
if (code.includes('This is a big library.')) {
return src
}
return false
})
)
).filter((item) => item)
).toBeEmpty()
})
})