Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move tests into their test folder #44183

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -4,7 +4,7 @@ import path from 'path'
createNextDescribe(
'app-dir alias handling',
{
files: path.join(__dirname, 'app-alias'),
files: __dirname,
packageJson: {
type: 'module',
},
Expand Down
@@ -1,10 +1,9 @@
import { createNextDescribe } from 'e2e-utils'
import path from 'path'

createNextDescribe(
'app-dir global edge configuration',
{
files: path.join(__dirname, 'app-edge-global'),
files: __dirname,
skipDeployment: true,
},
({ next }) => {
Expand Down
@@ -1,11 +1,10 @@
import { createNextDescribe } from 'e2e-utils'
import { check } from 'next-test-utils'
import path from 'path'

createNextDescribe(
'app-dir edge SSR',
{
files: path.join(__dirname, 'app-edge'),
files: __dirname,
skipDeployment: true,
},
({ next }) => {
Expand Down
@@ -1,4 +1,3 @@
import path from 'path'
import { createNextDescribe } from 'e2e-utils'

async function resolveStreamResponse(response: any, onData?: any) {
Expand All @@ -18,7 +17,7 @@ async function resolveStreamResponse(response: any, onData?: any) {
createNextDescribe(
'app dir - external dependency',
{
files: path.join(__dirname, './app-external'),
files: __dirname,
dependencies: {
'@next/font': 'canary',
react: 'latest',
Expand Down
Expand Up @@ -6,7 +6,7 @@ import path from 'path'
createNextDescribe(
'app-dir with middleware',
{
files: path.join(__dirname, 'app-middleware'),
files: __dirname,
skipDeployment: true,
},
({ next }) => {
Expand Down Expand Up @@ -121,10 +121,8 @@ createNextDescribe(
'app dir middleware without pages dir',
{
files: {
app: new FileRef(path.join(__dirname, 'app-middleware/app')),
'next.config.js': new FileRef(
path.join(__dirname, 'app-middleware/next.config.js')
),
app: new FileRef(path.join(__dirname, 'app')),
'next.config.js': new FileRef(path.join(__dirname, 'next.config.js')),
'middleware.js': `
import { NextResponse } from 'next/server'

Expand Down
@@ -1,11 +1,10 @@
import { createNextDescribe } from 'e2e-utils'
import { waitFor } from 'next-test-utils'
import path from 'path'

createNextDescribe(
'app dir prefetching',
{
files: path.join(__dirname, 'app-prefetch'),
files: __dirname,
skipDeployment: true,
},
({ next, isNextDev }) => {
Expand Down
@@ -1,12 +1,11 @@
import { createNextDescribe } from 'e2e-utils'
import { waitFor } from 'next-test-utils'
import path from 'path'
import cheerio from 'cheerio'

createNextDescribe(
'app dir rendering',
{
files: path.join(__dirname, 'app-rendering'),
files: __dirname,
skipDeployment: true,
},
({ next, isNextDev: isDev }) => {
Expand Down
@@ -1,7 +1,7 @@
import globOrig from 'glob'
import cheerio from 'cheerio'
import { promisify } from 'util'
import path, { join } from 'path'
import { join } from 'path'
import { createNextDescribe } from 'e2e-utils'
import { check, normalizeRegEx, waitFor } from 'next-test-utils'

Expand All @@ -10,7 +10,7 @@ const glob = promisify(globOrig)
createNextDescribe(
'app-dir static/dynamic handling',
{
files: path.join(__dirname, 'app-static'),
files: __dirname,
},
({ next, isNextDev: isDev, isNextStart }) => {
if (isNextStart) {
Expand Down
@@ -1,13 +1,12 @@
import { createNextDescribe } from 'e2e-utils'
import crypto from 'crypto'
import { check, getRedboxHeader, hasRedbox, waitFor } from 'next-test-utils'
import path from 'path'
import cheerio from 'cheerio'

createNextDescribe(
'app dir',
{
files: path.join(__dirname, 'app'),
files: __dirname,
dependencies: {
swr: '2.0.0-rc.0',
react: 'latest',
Expand Down
@@ -1,4 +1,4 @@
import { createNextDescribe, FileRef } from 'e2e-utils'
import { createNextDescribe } from 'e2e-utils'
import fs from 'fs-extra'
import os from 'os'
import path from 'path'
Expand All @@ -15,7 +15,7 @@ if (!(globalThis as any).isNextStart) {
createNextDescribe(
'output: standalone with app dir',
{
files: new FileRef(path.join(__dirname, 'app')),
files: __dirname,
dependencies: {
swr: '2.0.0-rc.0',
react: 'latest',
Expand Down
@@ -1,7 +1,6 @@
import { createNext, FileRef } from 'e2e-utils'
import { createNext } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { check } from 'next-test-utils'
import path from 'path'

describe('vercel analytics', () => {
const isDev = (global as any).isNextDev
Expand All @@ -16,7 +15,7 @@ describe('vercel analytics', () => {
function runTests({ assetPrefix }: { assetPrefix?: boolean }) {
beforeAll(async () => {
next = await createNext({
files: new FileRef(path.join(__dirname, 'app')),
files: __dirname,
dependencies: {
swr: '2.0.0-rc.0',
react: 'latest',
Expand Down
@@ -1,10 +1,9 @@
import { createNextDescribe } from 'e2e-utils'
import path from 'path'

createNextDescribe(
'app-dir assetPrefix handling',
{
files: path.join(__dirname, 'asset-prefix'),
files: __dirname,
skipDeployment: true,
},
({ next }) => {
Expand Down
@@ -1,10 +1,9 @@
import { createNextDescribe } from 'e2e-utils'
import path from 'path'

createNextDescribe(
'async-component-preload',
{
files: path.join(__dirname, 'async-component-preload'),
files: __dirname,
skipDeployment: true,
},
({ next }) => {
Expand Down
@@ -1,12 +1,11 @@
import { createNextDescribe } from 'e2e-utils'
import path from 'path'

// TODO-APP: fix test as it's failing randomly
describe.skip('app-dir back button download bug', () => {
createNextDescribe(
'app-dir back button download bug',
{
files: path.join(__dirname, 'back-button-download-bug'),
files: __dirname,
skipDeployment: true,
},
({ next }) => {
Expand Down
Expand Up @@ -19,9 +19,9 @@ describe('app-dir create root layout', () => {
beforeAll(async () => {
next = await createNext({
files: {
app: new FileRef(path.join(__dirname, 'create-root-layout/app')),
app: new FileRef(path.join(__dirname, 'app')),
'next.config.js': new FileRef(
path.join(__dirname, 'create-root-layout/next.config.js')
path.join(__dirname, 'next.config.js')
),
},
dependencies: {
Expand Down Expand Up @@ -79,11 +79,9 @@ describe('app-dir create root layout', () => {
beforeAll(async () => {
next = await createNext({
files: {
app: new FileRef(
path.join(__dirname, 'create-root-layout/app-group-layout')
),
app: new FileRef(path.join(__dirname, 'app-group-layout')),
'next.config.js': new FileRef(
path.join(__dirname, 'create-root-layout/next.config.js')
path.join(__dirname, 'next.config.js')
),
},
dependencies: {
Expand Down Expand Up @@ -143,14 +141,9 @@ describe('app-dir create root layout', () => {
beforeAll(async () => {
next = await createNext({
files: {
app: new FileRef(
path.join(
__dirname,
'create-root-layout/app-find-available-dir'
)
),
app: new FileRef(path.join(__dirname, 'app-find-available-dir')),
'next.config.js': new FileRef(
path.join(__dirname, 'create-root-layout/next.config.js')
path.join(__dirname, 'next.config.js')
),
},
dependencies: {
Expand Down Expand Up @@ -212,10 +205,10 @@ describe('app-dir create root layout', () => {
next = await createNext({
files: {
'app/page.tsx': new FileRef(
path.join(__dirname, 'create-root-layout/app/route/page.js')
path.join(__dirname, 'app/route/page.js')
),
'next.config.js': new FileRef(
path.join(__dirname, 'create-root-layout/next.config.js')
path.join(__dirname, 'next.config.js')
),
},
})
Expand Down Expand Up @@ -275,10 +268,10 @@ describe('app-dir create root layout', () => {
skipStart: true,
files: {
'app/page.js': new FileRef(
path.join(__dirname, 'create-root-layout/app/route/page.js')
path.join(__dirname, 'app/route/page.js')
),
'next.config.js': new FileRef(
path.join(__dirname, 'create-root-layout/next.config.js')
path.join(__dirname, 'next.config.js')
),
},
dependencies: {
Expand Down
@@ -1,11 +1,10 @@
import { createNextDescribe } from 'e2e-utils'
import { getRedboxDescription, hasRedbox } from 'next-test-utils'
import path from 'path'

createNextDescribe(
'dynamic-href',
{
files: path.join(__dirname, 'dynamic-href'),
files: __dirname,
skipDeployment: true,
},
({ isNextDev: isDev, next }) => {
Expand Down
@@ -1,11 +1,10 @@
import path from 'path'
import { getRedboxHeader, hasRedbox } from 'next-test-utils'
import { createNextDescribe } from 'e2e-utils'

createNextDescribe(
'app dir - global error',
{
files: path.join(__dirname, './global-error'),
files: __dirname,
},
({ next, isNextDev }) => {
it('should trigger error component when an error happens during rendering', async () => {
Expand Down
Expand Up @@ -6,7 +6,7 @@ import escapeStringRegexp from 'escape-string-regexp'
createNextDescribe(
'app dir head',
{
files: path.join(__dirname, 'head'),
files: __dirname,
skipDeployment: true,
},
({ next }) => {
Expand Down
@@ -1,10 +1,9 @@
import path from 'path'
import { createNextDescribe } from 'e2e-utils'

createNextDescribe(
'app dir imports',
{
files: path.join(__dirname, 'import'),
files: __dirname,
},
({ next }) => {
;['js', 'jsx', 'ts', 'tsx'].forEach((ext) => {
Expand Down
@@ -1,10 +1,9 @@
import path from 'path'
import { createNextDescribe } from 'e2e-utils'

createNextDescribe(
'app dir - layout params',
{
files: path.join(__dirname, './layout-params'),
files: __dirname,
},
({ next }) => {
describe('basic params', () => {
Expand Down
@@ -1,11 +1,10 @@
import { createNextDescribe } from 'e2e-utils'
import { getRedboxSource, hasRedbox } from 'next-test-utils'
import path from 'path'

createNextDescribe(
'app dir next-font',
{
files: path.join(__dirname, 'next-font'),
files: __dirname,
dependencies: {
'@next/font': 'canary',
react: 'latest',
Expand Down
@@ -1,10 +1,9 @@
import { createNextDescribe } from 'e2e-utils'
import path from 'path'

createNextDescribe(
'app dir next-image',
{
files: path.join(__dirname, 'next-image'),
files: __dirname,
skipDeployment: true,
},
({ next }) => {
Expand Down
@@ -1,11 +1,10 @@
import path from 'path'
import { createNextDescribe } from 'e2e-utils'
import { getRedboxSource, hasRedbox } from 'next-test-utils'

createNextDescribe(
'app-dir root layout',
{
files: path.join(__dirname, 'root-layout'),
files: __dirname,
skipDeployment: true,
},
({ next, isNextDev: isDev }) => {
Expand Down
@@ -1,7 +1,7 @@
import path from 'path'
import fs from 'fs-extra'
import { check } from 'next-test-utils'
import { createNext, FileRef } from 'e2e-utils'
import { createNext } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import cheerio from 'cheerio'

Expand Down Expand Up @@ -30,7 +30,7 @@ describe('app dir - rsc basics', () => {

beforeAll(async () => {
next = await createNext({
files: new FileRef(path.join(__dirname, './rsc-basic')),
files: __dirname,
dependencies: {
'styled-components': '6.0.0-beta.5',
react: 'latest',
Expand Down
@@ -1,4 +1,3 @@
import path from 'path'
import { check } from 'next-test-utils'
import { createNextDescribe } from 'e2e-utils'

Expand All @@ -8,7 +7,7 @@ if (!(globalThis as any).isNextDev) {
createNextDescribe(
'app dir - rsc errors',
{
files: path.join(__dirname, './rsc-errors'),
files: __dirname,
skipDeployment: true,
},
({ next }) => {
Expand Down