Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
ddc26c99
Unverified
Commit
ddc26c99
authored
Sep 11, 2023
by
OJ Kwon
Committed by
GitHub
Sep 11, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(turbopack): migrate 404-related tests from next-dev (#55243)
Closes WEB-1535
parent
476fe4a1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
4 additions
and
84 deletions
+4
-84
_error.tsx
...ntegration/next/pages/404-navigate/input/pages/_error.tsx
+0
-15
index.tsx
...integration/next/pages/404-navigate/input/pages/index.tsx
+0
-48
link.tsx
.../integration/next/pages/404-navigate/input/pages/link.tsx
+0
-12
not-found.tsx
...gration/next/pages/404-navigate/input/pages/not-found.tsx
+0
-9
turbopack-tests-manifest.js
test/turbopack-tests-manifest.js
+4
-0
No files found.
packages/next-swc/crates/next-dev-tests/tests/integration/next/pages/404-navigate/input/pages/_error.tsx
deleted
100644 → 0
View file @
476fe4a1
import
{
useTestHarness
}
from
'@turbo/pack-test-harness'
export
default
function
ErrorPage
(
props
:
{
static
:
'static'
})
{
useTestHarness
((
harness
)
=>
harness
.
markAsHydrated
())
return
<
div
data
-
test
-
error
>
{
props
.
static
}
</
div
>
}
export
function
getStaticProps
()
{
return
{
props
:
{
static
:
'static'
,
},
}
}
packages/next-swc/crates/next-dev-tests/tests/integration/next/pages/404-navigate/input/pages/index.tsx
deleted
100644 → 0
View file @
476fe4a1
import
{
useRef
}
from
'react'
import
{
Harness
,
useTestHarness
}
from
'@turbo/pack-test-harness'
export
default
function
Page
()
{
const
iframeRef
=
useRef
<
HTMLIFrameElement
|
null
>
(
null
)
useTestHarness
((
harness
)
=>
runTests
(
harness
,
iframeRef
.
current
!
))
return
(
<
iframe
style=
{
{
width
:
800
,
height
:
600
}
}
src=
"/link"
ref=
{
iframeRef
}
/>
)
}
function
runTests
(
harness
:
Harness
,
iframe
:
HTMLIFrameElement
)
{
// These tests requires a longer timeout because we're rendering the 404 page as well.
const
TIMEOUT
=
20000
it
(
'returns a 404 status code'
,
async
()
=>
{
const
res
=
await
fetch
(
'/not-found'
)
expect
(
res
.
status
).
toBe
(
404
)
},
TIMEOUT
)
it
(
'navigates to the 404 page'
,
async
()
=>
{
await
harness
.
waitForHydration
(
iframe
,
'/link'
)
const
link
=
iframe
.
contentDocument
!
.
querySelector
(
'a[data-test-link]'
)
expect
(
link
).
not
.
toBeNull
()
expect
(
link
!
).
toBeInstanceOf
(
(
iframe
.
contentWindow
as
any
).
HTMLAnchorElement
)
expect
(
link
!
.
textContent
).
toBe
(
'Not found'
)
;(
link
as
HTMLAnchorElement
).
click
()
await
harness
.
waitForHydration
(
iframe
,
'/not-found'
)
const
error
=
iframe
.
contentDocument
!
.
querySelector
(
'[data-test-error]'
)
expect
(
error
).
not
.
toBeNull
()
expect
(
error
!
.
textContent
).
toBe
(
'static'
)
},
TIMEOUT
)
}
packages/next-swc/crates/next-dev-tests/tests/integration/next/pages/404-navigate/input/pages/link.tsx
deleted
100644 → 0
View file @
476fe4a1
import
Link
from
'next/link'
import
{
useTestHarness
}
from
'@turbo/pack-test-harness'
export
default
function
Page
()
{
useTestHarness
((
mod
)
=>
mod
.
markAsHydrated
())
return
(
<
Link
href=
"/not-found"
data
-
test
-
link
>
Not found
</
Link
>
)
}
packages/next-swc/crates/next-dev-tests/tests/integration/next/pages/404-navigate/input/pages/not-found.tsx
deleted
100644 → 0
View file @
476fe4a1
export
default
function
Page
()
{
return
<
div
>
Page
</
div
>
}
export
function
getStaticProps
()
{
return
{
notFound
:
true
,
}
}
test/turbopack-tests-manifest.js
View file @
ddc26c99
...
...
@@ -109,6 +109,10 @@ const enabledTests = [
'test/e2e/typescript-version-no-warning/typescript-version-no-warning.test.ts'
,
'test/e2e/typescript-version-warning/typescript-version-warning.test.ts'
,
'test/e2e/undici-fetch/index.test.ts'
,
'test/integration/404-page/test/index.test.js'
,
'test/integration/404-page-app/test/index.test.js'
,
'test/integration/404-page-custom-error/test/index.test.js'
,
'test/integration/404-page-ssg/test/index.test.js'
,
'test/integration/create-next-app/templates-app.test.ts'
,
'test/integration/create-next-app/templates-pages.test.ts'
,
'test/integration/custom-routes-i18n-index-redirect/test/index.test.js'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment