Skip to content

Commit

Permalink
Add test for development output
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Jan 26, 2020
1 parent 5595d64 commit 8327723
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions test/integration/config-empty/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import { nextBuild } from 'next-test-utils'
import {
nextBuild,
launchApp,
findPort,
killApp,
waitFor,
} from 'next-test-utils'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2

const appDir = join(__dirname, '..')

describe('Empty configuration', () => {
it('should show relevant warning and compile successfully', async () => {
const { stderr, stdout } = await nextBuild(join(__dirname, '..'), [], {
it('should show relevant warning and compile successfully for next build', async () => {
const { stderr, stdout } = await nextBuild(appDir, [], {
stderr: true,
stdout: true,
})
expect(stdout).toMatch(/Compiled successfully./)
expect(stderr).toMatch(
/Warning: Detected next.config.js, no exported configuration found./
)
})

it('should show relevant warning and compile successfully for next dev', async () => {
let stderr = ''

const appPort = await findPort()
const app = await launchApp(appDir, appPort, {
onStderr(msg) {
stderr += msg || ''
},
})
await waitFor(1000)
await killApp(app)

expect(stderr).toMatch(
/Warning: Detected next.config.js, no exported configuration found./
)
expect(stdout).toMatch(/Compiled successfully./)
})
})

0 comments on commit 8327723

Please sign in to comment.