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
37568010
Commit
37568010
authored
Sep 06, 2024
by
Janka Uryga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: check most possible combination of CNA flags
parent
9a72ad6e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
matrix.test.ts
test/integration/create-next-app/templates/matrix.test.ts
+77
-0
No files found.
test/integration/create-next-app/templates/matrix.test.ts
0 → 100644
View file @
37568010
import
{
createNextApp
,
spawnExitPromise
,
tryNextDev
,
useTempDir
,
}
from
'../utils'
let
testVersion
beforeAll
(
async
()
=>
{
if
(
testVersion
)
return
// TODO: investigate moving this post publish or create deployed GH#57025
// tarballs to avoid these failing while a publish is in progress
testVersion
=
'latest'
// const span = new Span({ name: 'parent' })
// testVersion = (
// await createNextInstall({ onlyPackages: true, parentSpan: span })
// ).get('next')
})
describe
.
each
([
'app'
,
'pages'
]
as
const
)(
'CNA options matrix - %s'
,
(
pagesOrApp
)
=>
{
const
allFlagValues
=
{
app
:
[
pagesOrApp
===
'app'
?
'--app'
:
'--no-app'
],
ts
:
[
'--js'
,
'--ts'
],
importAlias
:
[
'--import-alias=@acme/*'
,
'--import-alias=@/*'
,
'--no-import-alias'
,
],
// doesn't affect if the app builds or not
// eslint: ['--eslint', '--no-eslint'],
eslint
:
[
'--eslint'
],
srcDir
:
[
'--src-dir'
,
'--no-src-dir'
],
tailwind
:
[
'--tailwind'
,
'--no-tailwind'
],
// shouldn't affect if the app builds or not
// packageManager: ['--use-npm', '--use-pnpm', '--use-yarn', '--use-bun'],
}
const
getPermutations
=
<
T
>
(
items
:
T
[][]):
T
[][]
=>
{
if
(
!
items
.
length
)
return
[[]]
const
[
first
,
...
rest
]
=
items
const
children
=
getPermutations
(
rest
)
return
first
.
flatMap
((
value
)
=>
children
.
map
((
child
)
=>
[
value
,
...
child
])
)
}
const
flagPermutations
=
getPermutations
(
Object
.
values
(
allFlagValues
))
const
testCases
=
flagPermutations
.
map
((
flags
)
=>
({
name
:
flags
.
join
(
' '
),
flags
,
}))
let
id
=
0
it
.
each
(
testCases
)(
'$name'
,
async
({
flags
})
=>
{
await
useTempDir
(
async
(
cwd
)
=>
{
const
projectName
=
`cna-matrix-
${
pagesOrApp
}
-
${
id
++
}
`
const
childProcess
=
createNextApp
(
[
projectName
,
...
flags
],
{
cwd
,
},
testVersion
)
const
exitCode
=
await
spawnExitPromise
(
childProcess
)
expect
(
exitCode
).
toBe
(
0
)
await
tryNextDev
({
cwd
,
projectName
,
})
})
})
}
)
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