diff --git a/test/integration/config-empty/next.config.js b/test/integration/config-empty/next.config.js new file mode 100644 index 000000000000000..0c04cc72881a0fa --- /dev/null +++ b/test/integration/config-empty/next.config.js @@ -0,0 +1,6 @@ +/* eslint-disable */ +{ + experimental: { + basePath: '/docs' + } +} diff --git a/test/integration/config-empty/pages/index.js b/test/integration/config-empty/pages/index.js new file mode 100644 index 000000000000000..02d90896bf336a9 --- /dev/null +++ b/test/integration/config-empty/pages/index.js @@ -0,0 +1 @@ +export default () =>
Hello World
diff --git a/test/integration/config-empty/test/index.test.js b/test/integration/config-empty/test/index.test.js new file mode 100644 index 000000000000000..4e850c44b9f24c6 --- /dev/null +++ b/test/integration/config-empty/test/index.test.js @@ -0,0 +1,17 @@ +/* eslint-env jest */ +/* global jasmine */ +import { join } from 'path' +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, '..'), [], { + stdout: true, + }) + expect(stdout).not.toMatch( + /Warning: Detected next.config.js, no exported configuration found./ + ) + }) +}) diff --git a/test/isolated/_resolvedata/no-export/next.config.js b/test/isolated/_resolvedata/no-export/next.config.js deleted file mode 100644 index ecd8a39e2a097ac..000000000000000 --- a/test/isolated/_resolvedata/no-export/next.config.js +++ /dev/null @@ -1,3 +0,0 @@ -// eslint-disable-next-line no-lone-blocks -{ -} diff --git a/test/isolated/config.test.js b/test/isolated/config.test.js index e88cefa2105093b..0607992907152ba 100644 --- a/test/isolated/config.test.js +++ b/test/isolated/config.test.js @@ -108,19 +108,4 @@ describe('config', () => { ) expect(config.__test__ext).toBe('js') }) - - it('Should log a warning when no exported configuration found', () => { - const spy = jest.spyOn(console, 'warn') - - loadConfig( - PHASE_DEVELOPMENT_SERVER, - join(__dirname, '_resolvedata', 'no-export') - ) - - expect(spy.mock.calls[0][0]).toMatch( - 'Detected next.config.js, no exported configuration found' - ) - - spy.mockRestore() - }) })