Move tests into their test folder (#44183)
This commit is contained in:
parent
6f1f3e6ced
commit
6713ce4cab
27 changed files with 42 additions and 71 deletions
|
@ -4,7 +4,7 @@ import path from 'path'
|
|||
createNextDescribe(
|
||||
'app-dir alias handling',
|
||||
{
|
||||
files: path.join(__dirname, 'app-alias'),
|
||||
files: __dirname,
|
||||
packageJson: {
|
||||
type: 'module',
|
||||
},
|
|
@ -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 }) => {
|
|
@ -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 }) => {
|
|
@ -1,4 +1,3 @@
|
|||
import path from 'path'
|
||||
import { createNextDescribe } from 'e2e-utils'
|
||||
|
||||
async function resolveStreamResponse(response: any, onData?: any) {
|
||||
|
@ -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',
|
|
@ -6,7 +6,7 @@ import path from 'path'
|
|||
createNextDescribe(
|
||||
'app-dir with middleware',
|
||||
{
|
||||
files: path.join(__dirname, 'app-middleware'),
|
||||
files: __dirname,
|
||||
skipDeployment: true,
|
||||
},
|
||||
({ next }) => {
|
||||
|
@ -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'
|
||||
|
|
@ -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 }) => {
|
|
@ -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 }) => {
|
|
@ -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'
|
||||
|
||||
|
@ -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) {
|
|
@ -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',
|
|
@ -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'
|
||||
|
@ -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',
|
|
@ -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
|
||||
|
@ -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',
|
|
@ -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 }) => {
|
|
@ -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 }) => {
|
|
@ -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 }) => {
|
|
@ -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: {
|
||||
|
@ -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: {
|
||||
|
@ -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: {
|
||||
|
@ -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')
|
||||
),
|
||||
},
|
||||
})
|
||||
|
@ -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: {
|
|
@ -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 }) => {
|
|
@ -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 () => {
|
|
@ -6,7 +6,7 @@ import escapeStringRegexp from 'escape-string-regexp'
|
|||
createNextDescribe(
|
||||
'app dir head',
|
||||
{
|
||||
files: path.join(__dirname, 'head'),
|
||||
files: __dirname,
|
||||
skipDeployment: true,
|
||||
},
|
||||
({ next }) => {
|
|
@ -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) => {
|
|
@ -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', () => {
|
|
@ -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',
|
|
@ -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 }) => {
|
|
@ -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 }) => {
|
|
@ -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'
|
||||
|
||||
|
@ -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',
|
|
@ -1,4 +1,3 @@
|
|||
import path from 'path'
|
||||
import { check } from 'next-test-utils'
|
||||
import { createNextDescribe } from 'e2e-utils'
|
||||
|
||||
|
@ -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 }) => {
|
|
@ -1,10 +1,9 @@
|
|||
import { createNextDescribe } from 'e2e-utils'
|
||||
import path from 'path'
|
||||
|
||||
createNextDescribe(
|
||||
'app-dir trailingSlash handling',
|
||||
{
|
||||
files: path.join(__dirname, 'trailingslash'),
|
||||
files: __dirname,
|
||||
skipDeployment: true,
|
||||
},
|
||||
({ next }) => {
|
|
@ -1,10 +1,9 @@
|
|||
import { createNextDescribe } from 'e2e-utils'
|
||||
import path from 'path'
|
||||
|
||||
createNextDescribe(
|
||||
'with babel',
|
||||
{
|
||||
files: path.join(__dirname, 'with-babel'),
|
||||
files: __dirname,
|
||||
skipDeployment: true,
|
||||
},
|
||||
({ next }) => {
|
Loading…
Reference in a new issue