Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to latest watchpack with dynamic route rename fix (#10351)
* Fix dynamic route rename failing for case change * Update normalizing curPageFiles * Remove using webpacks file info since its inaccurate * Revert changes in favor of fixing upstream * Update to latest watchpack with case rename fix
- Loading branch information
Showing
4 changed files
with
59 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default () => 'hi' |
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* eslint-env jest */ | ||
/* global jasmine */ | ||
import fs from 'fs-extra' | ||
import { join } from 'path' | ||
import { | ||
renderViaHTTP, | ||
launchApp, | ||
findPort, | ||
killApp, | ||
waitFor, | ||
} from 'next-test-utils' | ||
|
||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 30 * 2 | ||
|
||
let app | ||
let appPort | ||
let stderr = '' | ||
|
||
const appDir = join(__dirname, '../') | ||
const pageFile = join(appDir, 'pages/[pid].js') | ||
const pageFileAlt = join(appDir, 'pages/[PiD].js') | ||
|
||
describe('Dynamic route rename casing', () => { | ||
beforeAll(async () => { | ||
appPort = await findPort() | ||
app = await launchApp(appDir, appPort, { | ||
onStderr(msg) { | ||
stderr += msg || '' | ||
}, | ||
}) | ||
}) | ||
afterAll(() => killApp(app)) | ||
|
||
it('should not throw error when changing casing of dynamic route file', async () => { | ||
// make sure route is loaded in webpack | ||
const html = await renderViaHTTP(appPort, '/abc') | ||
expect(html).toContain('hi') | ||
|
||
await fs.rename(pageFile, pageFileAlt) | ||
await waitFor(2000) | ||
|
||
expect(stderr).not.toContain( | ||
`You cannot use different slug names for the same dynamic path` | ||
) | ||
|
||
await fs.rename(pageFileAlt, pageFile) | ||
await waitFor(2000) | ||
|
||
expect(stderr).not.toContain( | ||
`You cannot use different slug names for the same dynamic path` | ||
) | ||
}) | ||
}) |
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