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
3234b50f
Unverified
Commit
3234b50f
authored
Mar 20, 2024
by
Balázs Orbán
Committed by
GitHub
Mar 20, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(test): don't use `global as any` in test utils (#63241)
parent
ad1dc3f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
17 deletions
+14
-17
e2e-utils.ts
test/lib/e2e-utils.ts
+8
-8
base.ts
test/lib/next-modes/base.ts
+6
-9
No files found.
test/lib/e2e-utils.ts
View file @
3234b50f
...
...
@@ -245,7 +245,7 @@ export function nextTestSetup(
if
(
options
.
skipDeployment
)
{
// When the environment is running for deployment tests.
if
(
(
global
as
any
).
isNextDeploy
)
{
if
(
isNextDeploy
)
{
// eslint-disable-next-line jest/no-focused-tests
it
.
only
(
'should skip next deploy'
,
()
=>
{})
// No tests are run.
...
...
@@ -281,22 +281,22 @@ export function nextTestSetup(
})
return
{
get
isNextDev
()
:
boolean
{
return
Boolean
((
global
as
any
).
isNextDev
)
get
isNextDev
()
{
return
isNextDev
},
get
isTurbopack
():
boolean
{
return
Boolean
(
(
global
as
any
).
isNextDev
&&
isNextDev
&&
!
process
.
env
.
TEST_WASM
&&
(
options
.
turbo
??
shouldRunTurboDevTest
())
)
},
get
isNextDeploy
()
:
boolean
{
return
Boolean
((
global
as
any
).
isNextDeploy
)
get
isNextDeploy
()
{
return
isNextDeploy
},
get
isNextStart
()
:
boolean
{
return
Boolean
((
global
as
any
).
isNextStart
)
get
isNextStart
()
{
return
isNextStart
},
get
next
()
{
return
nextProxy
...
...
test/lib/next-modes/base.ts
View file @
3234b50f
...
...
@@ -3,7 +3,7 @@ import path from 'path'
import
{
existsSync
,
promises
as
fs
}
from
'fs'
import
treeKill
from
'tree-kill'
import
type
{
NextConfig
}
from
'next'
import
{
FileRef
}
from
'../e2e-utils'
import
{
FileRef
,
isNextDeploy
,
isNextDev
}
from
'../e2e-utils'
import
{
ChildProcess
}
from
'child_process'
import
{
createNextInstall
}
from
'../create-next-install'
import
{
Span
}
from
'next/src/trace'
...
...
@@ -75,7 +75,7 @@ export class NextInstance {
require
(
'console'
).
log
(
'packageJson??'
,
this
.
packageJson
)
if
(
!
(
global
as
any
).
isNextDeploy
)
{
if
(
!
isNextDeploy
)
{
this
.
env
=
{
...
this
.
env
,
// remove node_modules/.bin repo path from env
...
...
@@ -205,7 +205,7 @@ export class NextInstance {
!
this
.
dependencies
&&
!
this
.
installCommand
&&
!
this
.
packageJson
&&
!
(
global
as
any
).
isNextDeploy
!
isNextDeploy
)
{
await
fs
.
cp
(
process
.
env
.
NEXT_TEST_STARTER
,
this
.
testDir
,
{
recursive
:
true
,
...
...
@@ -244,10 +244,7 @@ export class NextInstance {
)
}
if
(
this
.
nextConfig
||
((
global
as
any
).
isNextDeploy
&&
!
nextConfigFile
)
)
{
if
(
this
.
nextConfig
||
(
isNextDeploy
&&
!
nextConfigFile
))
{
const
functions
=
[]
const
exportDeclare
=
this
.
packageJson
?.
type
===
'module'
...
...
@@ -281,7 +278,7 @@ export class NextInstance {
)
}
if
(
(
global
as
any
).
isNextDeploy
)
{
if
(
isNextDeploy
)
{
const
fileName
=
path
.
join
(
this
.
testDir
,
nextConfigFile
||
'next.config.js'
...
...
@@ -450,7 +447,7 @@ export class NextInstance {
// TODO: replace this with an event directly from WatchPack inside
// router-server for better accuracy
if
(
(
global
as
any
).
isNextDev
&&
isNextDev
&&
(
filename
.
startsWith
(
'app/'
)
||
filename
.
startsWith
(
'pages/'
))
)
{
require
(
'console'
).
log
(
'fs dev delay'
,
filename
)
...
...
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