Skip to content

Commit

Permalink
fix: 9919 add check for successfull compilation and fix warnin check
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrika committed Jan 25, 2020
1 parent f6cdb7b commit a298024
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions packages/next/next-server/server/config.ts
Expand Up @@ -229,7 +229,9 @@ export default function loadConfig(
userConfigModule.default || userConfigModule
)

console.log('userConfig', userConfig)
if (Object.keys(userConfig).length === 0) {
console.log('lolololo')
console.warn(
chalk.yellow.bold('Warning: ') +
'Detected next.config.js, no exported configuration found.'
Expand Down
9 changes: 6 additions & 3 deletions test/integration/config-empty/test/index.test.js
Expand Up @@ -6,12 +6,15 @@ import { nextBuild } from 'next-test-utils'
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 5

describe('Empty configuration', () => {
it('should show relevant warning when configuration is not found', async () => {
const { stdout } = await nextBuild(join(__dirname, '..'), [], {
it('should show relevant warning and compile successfully', async () => {
const { stderr, stdout } = await nextBuild(join(__dirname, '..'), [], {
stderr: true,
stdout: true,
})
expect(stdout).not.toMatch(

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

0 comments on commit a298024

Please sign in to comment.