-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor more tests to createNextDescribe (#44104)
- Loading branch information
1 parent
b8ae447
commit 7a2ec41
Showing
39 changed files
with
2,658 additions
and
3,224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,45 @@ | ||
import { createNext, FileRef } from 'e2e-utils' | ||
import { NextInstance } from 'test/lib/next-modes/base' | ||
import { renderViaHTTP } from 'next-test-utils' | ||
import webdriver from 'next-webdriver' | ||
import { createNextDescribe } from 'e2e-utils' | ||
import path from 'path' | ||
import { readJSON } from 'fs-extra' | ||
|
||
describe('app-dir alias handling', () => { | ||
if ((global as any).isNextDeploy) { | ||
it('should skip next deploy for now', () => {}) | ||
return | ||
} | ||
|
||
let next: NextInstance | ||
|
||
beforeAll(async () => { | ||
next = await createNext({ | ||
files: new FileRef(path.join(__dirname, 'app-alias')), | ||
dependencies: { | ||
react: 'latest', | ||
'react-dom': 'latest', | ||
typescript: 'latest', | ||
'@types/react': 'latest', | ||
'@types/node': 'latest', | ||
}, | ||
packageJson: { | ||
type: 'module', | ||
}, | ||
createNextDescribe( | ||
'app-dir alias handling', | ||
{ | ||
files: path.join(__dirname, 'app-alias'), | ||
dependencies: { | ||
react: 'latest', | ||
'react-dom': 'latest', | ||
typescript: 'latest', | ||
'@types/react': 'latest', | ||
'@types/node': 'latest', | ||
}, | ||
packageJson: { | ||
type: 'module', | ||
}, | ||
skipDeployment: true, | ||
}, | ||
({ next, isNextDev }) => { | ||
it('should handle typescript paths alias correctly', async () => { | ||
const html = await next.render('/button') | ||
expect(html).toContain('click</button>') | ||
}) | ||
}) | ||
afterAll(() => next.destroy()) | ||
|
||
it('should handle typescript paths alias correctly', async () => { | ||
const html = await renderViaHTTP(next.url, '/button') | ||
expect(html).toContain('click</button>') | ||
}) | ||
|
||
it('should resolve css imports from outside with src folder presented', async () => { | ||
const browser = await webdriver(next.url, '/button') | ||
const fontSize = await browser | ||
.elementByCss('button') | ||
.getComputedCss('font-size') | ||
expect(fontSize).toBe('50px') | ||
}) | ||
it('should resolve css imports from outside with src folder presented', async () => { | ||
const browser = await next.browser('/button') | ||
const fontSize = await browser | ||
.elementByCss('button') | ||
.getComputedCss('font-size') | ||
expect(fontSize).toBe('50px') | ||
}) | ||
|
||
if (!(global as any).isNextDev) { | ||
it('should generate app-build-manifest correctly', async () => { | ||
// Remove other page CSS files: | ||
const manifest = await readJSON( | ||
path.join(next.testDir, '.next', 'app-build-manifest.json') | ||
) | ||
if (!isNextDev) { | ||
it('should generate app-build-manifest correctly', async () => { | ||
// Remove other page CSS files: | ||
const manifest = await next.readJSON( | ||
path.join('.next', 'app-build-manifest.json') | ||
) | ||
|
||
expect(manifest.pages).not.toBeEmptyObject() | ||
}) | ||
expect(manifest.pages).not.toBeEmptyObject() | ||
}) | ||
} | ||
} | ||
}) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,23 @@ | ||
import { createNext, FileRef } from 'e2e-utils' | ||
import { NextInstance } from 'test/lib/next-modes/base' | ||
import { renderViaHTTP } from 'next-test-utils' | ||
import { createNextDescribe } from 'e2e-utils' | ||
import path from 'path' | ||
|
||
describe('app-dir global edge configuration', () => { | ||
if ((global as any).isNextDeploy) { | ||
it('should skip next deploy for now', () => {}) | ||
return | ||
} | ||
|
||
let next: NextInstance | ||
|
||
beforeAll(async () => { | ||
next = await createNext({ | ||
files: new FileRef(path.join(__dirname, 'app-edge-global')), | ||
dependencies: { | ||
react: 'latest', | ||
'react-dom': 'latest', | ||
typescript: 'latest', | ||
'@types/react': 'latest', | ||
'@types/node': 'latest', | ||
}, | ||
createNextDescribe( | ||
'app-dir global edge configuration', | ||
{ | ||
files: path.join(__dirname, 'app-edge-global'), | ||
dependencies: { | ||
react: 'latest', | ||
'react-dom': 'latest', | ||
typescript: 'latest', | ||
'@types/react': 'latest', | ||
'@types/node': 'latest', | ||
}, | ||
skipDeployment: true, | ||
}, | ||
({ next }) => { | ||
it('should handle edge only routes', async () => { | ||
const html = await next.render('/app-edge') | ||
expect(html).toContain('<p>Edge!</p>') | ||
}) | ||
}) | ||
afterAll(() => next.destroy()) | ||
|
||
it('should handle edge only routes', async () => { | ||
const appHtml = await renderViaHTTP(next.url, '/app-edge') | ||
expect(appHtml).toContain('<p>Edge!</p>') | ||
}) | ||
}) | ||
} | ||
) |
Oops, something went wrong.