Skip to content

Commit

Permalink
chore: remove experimental appDir: true from tests (#52291)
Browse files Browse the repository at this point in the history
The experimental flag is no longer needed.

https://nextjs.org/blog/next-13-4
  • Loading branch information
styfle committed Jul 6, 2023
1 parent 8ed2b27 commit 525ffb4
Show file tree
Hide file tree
Showing 28 changed files with 2 additions and 220 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module.exports = {
experimental: {
appDir: true,
serverComponentsExternalPackages: ['package'],
},
}

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions packages/next-swc/crates/next-dev/benches/next.config.js

This file was deleted.

6 changes: 0 additions & 6 deletions test/.stats-app/stats-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ module.exports = {
path: 'next.config.js',
content: `
module.exports = {
experimental: {
appDir: true,
},
generateBuildId: () => 'BUILD_ID',
webpack(config) {
config.optimization.minimize = false
Expand All @@ -99,9 +96,6 @@ module.exports = {
path: 'next.config.js',
content: `
module.exports = {
experimental: {
appDir: true,
},
generateBuildId: () => 'BUILD_ID'
}
`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@ describe('ReactRefreshRegression app', () => {
});
module.exports = withMDX({
pageExtensions: ["js", "mdx"],
experimental: { appDir: true },
});
`
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { sandbox } from 'development-sandbox'
import { outdent } from 'outdent'

const initialFiles = new Map([
['next.config.js', 'module.exports = { experimental: { appDir: true } }'],
['app/_.js', ''], // app dir need to exists, otherwise the SWC RSC checks will not run
[
'pages/index.js',
Expand Down
11 changes: 0 additions & 11 deletions test/integration/build-spinners/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,6 @@ const appDirFiles: File[] = [
}
`,
},
{
filename: 'next.config.js',
content: `
module.exports = {
experimental: {
appDir: true
}
}
`,
},
]
const pagesFiles: File[] = [
{
Expand All @@ -65,7 +55,6 @@ it.each([
content: `
module.exports = {
experimental: {
appDir: true,
webpackBuildWorker: true,
}
}
Expand Down
5 changes: 0 additions & 5 deletions test/integration/eslint/base-directories/next.config.js

This file was deleted.

46 changes: 1 addition & 45 deletions test/integration/eslint/test/next-build.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,51 +81,7 @@ describe('Next Build', () => {
)
})

// Consolidate two tests below when the `appDir` is released.
test('base directories are linted by default during builds', async () => {
dirBaseDirectoriesConfigFile.write(`
module.exports = {
experimental: {
appDir: false,
}
}
`)
const { stdout, stderr } = await nextBuild(dirBaseDirectories, [], {
stdout: true,
stderr: true,
})

const output = stdout + stderr

expect(output).toContain('Failed to compile')
expect(output).toContain(
'Error: `next/head` should not be imported in `pages/_document.js`. Use `<Head />` from `next/document` instead'
)
expect(output).toContain(
'Warning: Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images.'
)
expect(output).toContain('Warning: Do not include stylesheets manually')
expect(output).toContain('Warning: Synchronous scripts should not be used')
expect(output).not.toContain(
'Warning: `rel="preconnect"` is missing from Google Font'
)

// Files in pages, components, lib, and src directories are linted
expect(output).toContain('pages/_document.js')
expect(output).toContain('components/bar.js')
expect(output).toContain('lib/foo.js')
expect(output).toContain('src/index.js')
expect(output).not.toContain('app/layout.js')
})

test('base directories with appDir flag are linted by default during builds', async () => {
dirBaseDirectoriesConfigFile.write(`
module.exports = {
experimental: {
appDir: true,
}
}
`)
const { stdout, stderr } = await nextBuild(dirBaseDirectories, [], {
stdout: true,
stderr: true,
Expand All @@ -146,7 +102,7 @@ describe('Next Build', () => {
'Warning: `rel="preconnect"` is missing from Google Font'
)

// Files in pages, app, components, lib, and src directories are linted
// Files in app, pages, components, lib, and src directories are linted
expect(output).toContain('pages/_document.js')
expect(output).toContain('components/bar.js')
expect(output).toContain('lib/foo.js')
Expand Down
47 changes: 1 addition & 46 deletions test/integration/eslint/test/next-lint.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ const dirPluginCoreWebVitalsConfig = join(
)
const dirIgnoreDuringBuilds = join(__dirname, '../ignore-during-builds')
const dirBaseDirectories = join(__dirname, '../base-directories')
const dirBaseDirectoriesConfigFile = new File(
join(dirBaseDirectories, '/next.config.js')
)
const dirCustomDirectories = join(__dirname, '../custom-directories')
const dirConfigInPackageJson = join(__dirname, '../config-in-package-json')
const dirInvalidOlderEslintVersion = join(
Expand Down Expand Up @@ -182,49 +179,7 @@ describe('Next Lint', () => {
)
})

// Consolidate two tests below when the `appDir` is released.
test('base directories are linted by default', async () => {
dirBaseDirectoriesConfigFile.write(`
module.exports = {
experimental: {
appDir: false,
}
}
`)
const { stdout, stderr } = await nextLint(dirBaseDirectories, [], {
stdout: true,
stderr: true,
})

const output = stdout + stderr
expect(output).toContain(
'Error: `next/head` should not be imported in `pages/_document.js`. Use `<Head />` from `next/document` instead'
)
expect(output).toContain(
'Warning: Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images.'
)
expect(output).toContain('Warning: Do not include stylesheets manually')
expect(output).toContain('Warning: Synchronous scripts should not be used')
expect(output).not.toContain(
'Warning: `rel="preconnect"` is missing from Google Font'
)

// Files in pages, components, lib, and src directories are linted
expect(output).toContain('pages/_document.js')
expect(output).toContain('components/bar.js')
expect(output).toContain('lib/foo.js')
expect(output).toContain('src/index.js')
expect(output).not.toContain('app/layout.js')
})

test('base directories with appDir flag are linted by default', async () => {
dirBaseDirectoriesConfigFile.write(`
module.exports = {
experimental: {
appDir: true,
}
}
`)
const { stdout, stderr } = await nextLint(dirBaseDirectories, [], {
stdout: true,
stderr: true,
Expand All @@ -243,7 +198,7 @@ describe('Next Lint', () => {
'Warning: `rel="preconnect"` is missing from Google Font'
)

// Files in pages, app, components, lib, and src directories are linted
// Files in app, pages, components, lib, and src directories are linted
expect(output).toContain('pages/_document.js')
expect(output).toContain('components/bar.js')
expect(output).toContain('lib/foo.js')
Expand Down
5 changes: 0 additions & 5 deletions test/integration/telemetry/test/page-features.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ import { check, findPort, killApp, launchApp, nextBuild } from 'next-test-utils'
const appDir = path.join(__dirname, '..')

const setupAppDir = async () => {
await fs.writeFile(
path.join(__dirname, '../next.config.js'),
'module.exports = { experimental: { appDir: true } }'
)
await fs.mkdir(path.join(__dirname, '../app'))
await fs.writeFile(
path.join(__dirname, '../app/layout.js'),
Expand All @@ -29,7 +25,6 @@ const setupAppDir = async () => {

return async function teardownAppDir() {
await fs.remove(path.join(__dirname, '../app'))
await fs.remove(path.join(__dirname, '../next.config.js'))
}
}

Expand Down
5 changes: 0 additions & 5 deletions test/production/app-dir-edge-runtime-with-wasm/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ describe('app-dir edge runtime with wasm', () => {
react: 'experimental',
'react-dom': 'experimental',
},
nextConfig: {
experimental: {
appDir: true,
},
},
})
})
afterAll(() => next.destroy())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ describe('should set-up next', () => {
eslint: {
ignoreDuringBuilds: true,
},
experimental: {
appDir: true,
},
output: 'standalone',
},
})
Expand Down

0 comments on commit 525ffb4

Please sign in to comment.