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
982e880f
Unverified
Commit
982e880f
authored
Apr 09, 2020
by
JJ Kasper
Committed by
GitHub
Apr 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update CNA tests on windows for further investigating (#11779)
parent
0c2a6d8f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
41 deletions
+49
-41
index.test.js
test/integration/create-next-app/index.test.js
+49
-41
No files found.
test/integration/create-next-app/index.test.js
View file @
982e880f
...
...
@@ -29,7 +29,7 @@ const runStarter = (...args) => {
describe
(
'create next app'
,
()
=>
{
beforeAll
(
async
()
=>
{
jest
.
setTimeout
(
1000
*
60
*
3
)
jest
.
setTimeout
(
1000
*
60
*
2
)
await
fs
.
mkdirp
(
cwd
)
})
...
...
@@ -47,18 +47,22 @@ describe('create next app', () => {
}
})
it
(
'empty directory'
,
async
()
=>
{
const
projectName
=
'empty-directory'
const
res
=
await
runStarter
(
projectName
)
expect
(
res
.
exitCode
).
toBe
(
0
)
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'package.json'
))
).
toBeTruthy
()
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'pages/index.js'
))
).
toBeTruthy
()
})
// TODO: investigate why this test stalls on yarn install when
// stdin is piped instead of inherited on windows
if
(
process
.
platform
!==
'win32'
)
{
it
(
'empty directory'
,
async
()
=>
{
const
projectName
=
'empty-directory'
const
res
=
await
runStarter
(
projectName
)
expect
(
res
.
exitCode
).
toBe
(
0
)
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'package.json'
))
).
toBeTruthy
()
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'pages/index.js'
))
).
toBeTruthy
()
})
}
it
(
'invalid example name'
,
async
()
=>
{
const
projectName
=
'invalid-example-name'
...
...
@@ -163,41 +167,45 @@ describe('create next app', () => {
).
toBeTruthy
()
})
it
(
'should allow to manually select an example'
,
async
()
=>
{
const
runExample
=
(...
args
)
=>
{
const
res
=
run
(...
args
)
function
pickExample
(
data
)
{
if
(
/hello-world/
.
test
(
data
.
toString
()))
{
res
.
stdout
.
removeListener
(
'data'
,
pickExample
)
res
.
stdin
.
write
(
'
\
n'
)
// TODO: investigate why this test stalls on yarn install when
// stdin is piped instead of inherited on windows
if
(
process
.
platform
!==
'win32'
)
{
it
(
'should allow to manually select an example'
,
async
()
=>
{
const
runExample
=
(...
args
)
=>
{
const
res
=
run
(...
args
)
function
pickExample
(
data
)
{
if
(
/hello-world/
.
test
(
data
.
toString
()))
{
res
.
stdout
.
removeListener
(
'data'
,
pickExample
)
res
.
stdin
.
write
(
'
\
n'
)
}
}
}
function
searchExample
(
data
)
{
if
(
/Pick an example/
.
test
(
data
.
toString
()))
{
res
.
stdout
.
removeListener
(
'data'
,
searchExample
)
res
.
stdin
.
write
(
'hello-world'
)
res
.
stdout
.
on
(
'data'
,
pickExample
)
function
searchExample
(
data
)
{
if
(
/Pick an example/
.
test
(
data
.
toString
()))
{
res
.
stdout
.
removeListener
(
'data'
,
searchExample
)
res
.
stdin
.
write
(
'hello-world'
)
res
.
stdout
.
on
(
'data'
,
pickExample
)
}
}
}
function
selectExample
(
data
)
{
if
(
/Pick a template/
.
test
(
data
.
toString
()))
{
res
.
stdout
.
removeListener
(
'data'
,
selectExample
)
res
.
stdin
.
write
(
'
\
u001b[B
\
n'
)
// Down key and enter
res
.
stdout
.
on
(
'data'
,
searchExample
)
function
selectExample
(
data
)
{
if
(
/Pick a template/
.
test
(
data
.
toString
()))
{
res
.
stdout
.
removeListener
(
'data'
,
selectExample
)
res
.
stdin
.
write
(
'
\
u001b[B
\
n'
)
// Down key and enter
res
.
stdout
.
on
(
'data'
,
searchExample
)
}
}
}
res
.
stdout
.
on
(
'data'
,
selectExample
)
res
.
stdout
.
on
(
'data'
,
selectExample
)
return
res
}
return
res
}
const
res
=
await
runExample
(
'no-example'
)
const
res
=
await
runExample
(
'no-example'
)
expect
(
res
.
exitCode
).
toBe
(
0
)
expect
(
res
.
stdout
).
toMatch
(
/Downloading files for example hello-world/
)
})
expect
(
res
.
exitCode
).
toBe
(
0
)
expect
(
res
.
stdout
).
toMatch
(
/Downloading files for example hello-world/
)
})
}
})
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