Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: ensure default output is correct #39358

Merged
merged 1 commit into from Aug 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 44 additions & 0 deletions test/production/escheck-output/index.test.ts
@@ -0,0 +1,44 @@
import { createNext } from 'e2e-utils'
import execa from 'execa'
import { NextInstance } from 'test/lib/next-modes/base'

describe('ES Check default output', () => {
let next: NextInstance

afterEach(() => next.destroy())

it('should pass for ES5', async () => {
next = await createNext({
files: { 'pages/index.js': 'export default function Page() {}' },
dependencies: { 'es-check': '7.0.0' },
})

const res = await execa(
'pnpm',
['es-check', 'es5', '.next/static/**/*.js'],
{ cwd: next.testDir }
)

expect(res.stdout).toBe(
'info: ES-Check: there were no ES version matching errors! 🎉'
)
})

it('should pass for ES5 with SWC minify', async () => {
next = await createNext({
files: { 'pages/index.js': 'export default function Page() {}' },
dependencies: { 'es-check': '7.0.0' },
nextConfig: { swcMinify: true },
})

const res = await execa(
'pnpm',
['es-check', 'es5', '.next/static/**/*.js'],
{ cwd: next.testDir }
)

expect(res.stdout).toBe(
'info: ES-Check: there were no ES version matching errors! 🎉'
)
})
})