From 8327723b32b5d5ba27e77b90865741a6e3b5b1d9 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Sun, 26 Jan 2020 14:51:39 -0600 Subject: [PATCH] Add test for development output --- .../config-empty/test/index.test.js | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/test/integration/config-empty/test/index.test.js b/test/integration/config-empty/test/index.test.js index fddde8dc8bb3b..a480a0d6ac64a 100644 --- a/test/integration/config-empty/test/index.test.js +++ b/test/integration/config-empty/test/index.test.js @@ -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./) }) })