-
Notifications
You must be signed in to change notification settings - Fork 27.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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./) | ||
}) | ||
}) |