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
dafdc81b
Commit
dafdc81b
authored
Sep 02, 2024
by
Janka Uryga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: convert app-external.test.ts to nextTestSetup
parent
2c80812e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
235 additions
and
241 deletions
+235
-241
app-external.test.ts
test/e2e/app-dir/app-external/app-external.test.ts
+235
-241
No files found.
test/e2e/app-dir/app-external/app-external.test.ts
View file @
dafdc81b
import
{
createNextDescribe
}
from
'e2e-utils'
import
{
nextTestSetup
}
from
'e2e-utils'
import
{
check
,
hasRedbox
,
retry
,
shouldRunTurboDevTest
}
from
'next-test-utils'
import
{
check
,
hasRedbox
,
retry
,
shouldRunTurboDevTest
}
from
'next-test-utils'
async
function
resolveStreamResponse
(
response
:
any
,
onData
?:
any
)
{
async
function
resolveStreamResponse
(
response
:
any
,
onData
?:
any
)
{
...
@@ -15,9 +15,8 @@ async function resolveStreamResponse(response: any, onData?: any) {
...
@@ -15,9 +15,8 @@ async function resolveStreamResponse(response: any, onData?: any) {
return
result
return
result
}
}
createNextDescribe
(
describe
(
'app dir - external dependency'
,
()
=>
{
'app dir - external dependency'
,
const
{
next
,
skipped
,
isTurbopack
}
=
nextTestSetup
({
{
files
:
__dirname
,
files
:
__dirname
,
dependencies
:
{
dependencies
:
{
swr
:
'latest'
,
swr
:
'latest'
,
...
@@ -34,8 +33,12 @@ createNextDescribe(
...
@@ -34,8 +33,12 @@ createNextDescribe(
startCommand
:
(
global
as
any
).
isNextDev
?
'pnpm dev'
:
'pnpm start'
,
startCommand
:
(
global
as
any
).
isNextDev
?
'pnpm dev'
:
'pnpm start'
,
buildCommand
:
'pnpm build'
,
buildCommand
:
'pnpm build'
,
skipDeployment
:
true
,
skipDeployment
:
true
,
},
})
({
next
,
isTurbopack
})
=>
{
if
(
skipped
)
{
return
}
it
(
'should be able to opt-out 3rd party packages being bundled in server components'
,
async
()
=>
{
it
(
'should be able to opt-out 3rd party packages being bundled in server components'
,
async
()
=>
{
await
next
.
fetch
(
'/react-server/optout'
).
then
(
async
(
response
)
=>
{
await
next
.
fetch
(
'/react-server/optout'
).
then
(
async
(
response
)
=>
{
const
result
=
await
resolveStreamResponse
(
response
)
const
result
=
await
resolveStreamResponse
(
response
)
...
@@ -156,9 +159,7 @@ createNextDescribe(
...
@@ -156,9 +159,7 @@ createNextDescribe(
async
()
=>
{
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/browser'
)
const
browser
=
await
next
.
browser
(
'/browser'
)
// eslint-disable-next-line jest/no-standalone-expect
// eslint-disable-next-line jest/no-standalone-expect
expect
(
await
browser
.
elementByCss
(
'#worker-state'
).
text
()).
toBe
(
expect
(
await
browser
.
elementByCss
(
'#worker-state'
).
text
()).
toBe
(
'default'
)
'default'
)
await
browser
.
elementByCss
(
'button'
).
click
()
await
browser
.
elementByCss
(
'button'
).
click
()
...
@@ -180,9 +181,7 @@ createNextDescribe(
...
@@ -180,9 +181,7 @@ createNextDescribe(
expect
(
v1
).
toBe
(
v2
)
expect
(
v1
).
toBe
(
v2
)
// Should work with both esm and cjs imports
// Should work with both esm and cjs imports
expect
(
html
).
toContain
(
expect
(
html
).
toContain
(
'CJS-ESM Compat package: cjs-esm-compat/index.mjs'
)
'CJS-ESM Compat package: cjs-esm-compat/index.mjs'
)
expect
(
html
).
toContain
(
'CJS package: cjs-lib'
)
expect
(
html
).
toContain
(
'CJS package: cjs-lib'
)
expect
(
html
).
toContain
(
expect
(
html
).
toContain
(
'Nested imports: nested-import:esm:cjs-esm-compat/index.mjs'
'Nested imports: nested-import:esm:cjs-esm-compat/index.mjs'
...
@@ -197,9 +196,7 @@ createNextDescribe(
...
@@ -197,9 +196,7 @@ createNextDescribe(
expect
(
v1
).
toBe
(
v2
)
expect
(
v1
).
toBe
(
v2
)
// Should work with both esm and cjs imports
// Should work with both esm and cjs imports
expect
(
html
).
toContain
(
expect
(
html
).
toContain
(
'CJS-ESM Compat package: cjs-esm-compat/index.mjs'
)
'CJS-ESM Compat package: cjs-esm-compat/index.mjs'
)
expect
(
html
).
toContain
(
'CJS package: cjs-lib'
)
expect
(
html
).
toContain
(
'CJS package: cjs-lib'
)
})
})
...
@@ -211,9 +208,7 @@ createNextDescribe(
...
@@ -211,9 +208,7 @@ createNextDescribe(
expect
(
v1
).
toBe
(
v2
)
expect
(
v1
).
toBe
(
v2
)
// Should work with both esm and cjs imports
// Should work with both esm and cjs imports
expect
(
html
).
toContain
(
expect
(
html
).
toContain
(
'CJS-ESM Compat package: cjs-esm-compat/index.mjs'
)
'CJS-ESM Compat package: cjs-esm-compat/index.mjs'
)
expect
(
html
).
toContain
(
'CJS package: cjs-lib'
)
expect
(
html
).
toContain
(
'CJS package: cjs-lib'
)
})
})
...
@@ -320,5 +315,4 @@ createNextDescribe(
...
@@ -320,5 +315,4 @@ createNextDescribe(
expect
(
text
).
toBe
(
'get route'
)
expect
(
text
).
toBe
(
'get route'
)
})
})
})
})
}
})
)
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