rsnext/test/integration/config-empty/test/index.test.js
Dmitry Rybin 41d1757b4e
fix: 9919 Add warning when no config is exported from next.con… (#10228)
* fix: 9919 no exported config found

* fix: 9919 remove isolated test, add integration

* fix: 9919 add check for successfull compilation and fix warnin check

* Add test for development output

* fix: 9919 add error page and link to it in warning

* Update empty-configuration.md

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2020-01-29 09:12:30 +01:00

44 lines
1.2 KiB
JavaScript

/* eslint-env jest */
/* global jasmine */
import { join } from 'path'
import {
nextBuild,
launchApp,
findPort,
killApp,
waitFor,
} from 'next-test-utils'
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2
const appDir = join(__dirname, '..')
describe('Empty configuration', () => {
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. https:\/\/err.sh\/zeit\/next.js\/empty-configuration/
)
})
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. https:\/\/err.sh\/zeit\/next.js\/empty-configuration/
)
})
})