File size: 1,307 Bytes
1e92f2d |
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 44 45 46 47 |
import { createNext, FileRef } from 'e2e-utils'
import { NextInstance } from 'e2e-utils'
import { renderViaHTTP, fetchViaHTTP } from 'next-test-utils'
import path from 'path'
import cheerio from 'cheerio'
const appDir = path.join(__dirname, 'app')
// TODO: This test needs to check multiple files and syntax features.
describe.skip('default browserslist target', () => {
let next: NextInstance
beforeAll(async () => {
next = await createNext({
files: {
pages: new FileRef(path.join(appDir, 'pages')),
},
})
})
afterAll(() => next.destroy())
it('should apply default browserslist target', async () => {
const html = await renderViaHTTP(next.url, '/')
const $ = cheerio.load(html)
expect(
(
await Promise.all(
$('script')
.toArray()
.map(async (el) => {
const src = $(el).attr('src')
const res = await fetchViaHTTP(next.url, src)
const code = await res.text()
// Default compiles for ES Modules output
if (code.includes('async ()=>')) {
return src
}
return false
})
)
)
// Filter out false values
.filter((item) => item)
).not.toBeEmpty()
})
})
|