Unverified Commit 442378d2 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Fix failing escheck test (#39365)

parent 5f483b97
import { createNext } from 'e2e-utils' import { createNext } from 'e2e-utils'
import execa from 'execa' import { NextConfig } from 'packages/next'
import { NextInstance } from 'test/lib/next-modes/base' import { NextInstance } from 'test/lib/next-modes/base'
describe('ES Check default output', () => { describe('ES Check default output', () => {
let next: NextInstance let next: NextInstance
afterEach(() => next.destroy()) beforeAll(async () => {
it('should pass for ES5', async () => {
next = await createNext({ next = await createNext({
files: { 'pages/index.js': 'export default function Page() {}' }, files: {
'pages/index.js': 'export default function Page() { return "hello" }',
},
dependencies: { 'es-check': '7.0.0' }, dependencies: { 'es-check': '7.0.0' },
packageJson: {
scripts: {
build: 'next build && es-check es5 .next/static/**/*.js',
},
},
buildCommand: 'yarn build',
}) })
})
afterAll(() => next.destroy())
const res = await execa( it('should pass for ES5', async () => {
'pnpm', expect(next.cliOutput).toContain(
['es-check', 'es5', '.next/static/**/*.js'],
{ cwd: next.testDir }
)
expect(res.stdout).toBe(
'info: ES-Check: there were no ES version matching errors! 🎉' 'info: ES-Check: there were no ES version matching errors! 🎉'
) )
}) })
it('should pass for ES5 with SWC minify', async () => { it('should pass for ES5 with SWC minify', async () => {
next = await createNext({ await next.stop()
files: { 'pages/index.js': 'export default function Page() {}' }, await next.deleteFile('.next')
dependencies: { 'es-check': '7.0.0' }, await next.patchFile(
nextConfig: { swcMinify: true }, 'next.config.js',
}) `
module.exports = ${JSON.stringify({ swcMinify: true } as NextConfig)}
const res = await execa( `
'pnpm',
['es-check', 'es5', '.next/static/**/*.js'],
{ cwd: next.testDir }
) )
await next.start()
expect(res.stdout).toBe( expect(next.cliOutput).toContain(
'info: ES-Check: there were no ES version matching errors! 🎉' 'info: ES-Check: there were no ES version matching errors! 🎉'
) )
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment