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
a2ea7a49
Unverified
Commit
a2ea7a49
authored
Jan 14, 2020
by
Joe Haddad
Committed by
GitHub
Jan 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Test for PR #10037 (#10093)
parent
6d2d675b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
0 deletions
+57
-0
_error.js
.../integration/render-error-on-module-error/pages/_error.js
+3
-0
index.js
test/integration/render-error-on-module-error/pages/index.js
+9
-0
index.test.js
...tegration/render-error-on-module-error/test/index.test.js
+45
-0
No files found.
test/integration/render-error-on-module-error/pages/_error.js
0 → 100644
View file @
a2ea7a49
export
default
function
Error
()
{
return
<
p
id
=
"error-p"
>
Error
Rendered
<
/p
>
}
test/integration/render-error-on-module-error/pages/index.js
0 → 100644
View file @
a2ea7a49
if
(
typeof
window
!==
'undefined'
)
{
throw
new
Error
(
'fail module evaluation'
)
}
const
Index
=
()
=>
'hi'
Index
.
getInitialProps
=
()
=>
({})
export
default
Index
test/integration/render-error-on-module-error/test/index.test.js
0 → 100644
View file @
a2ea7a49
/* eslint-env jest */
/* global jasmine */
import
{
nextBuild
,
nextServer
,
startApp
,
stopApp
,
waitFor
,
}
from
'next-test-utils'
import
webdriver
from
'next-webdriver'
import
{
join
}
from
'path'
jasmine
.
DEFAULT_TIMEOUT_INTERVAL
=
1000
*
60
*
2
const
appDir
=
join
(
__dirname
,
'..'
)
let
appPort
let
app
let
server
describe
(
'Module Init Error'
,
()
=>
{
beforeAll
(
async
()
=>
{
await
nextBuild
(
appDir
)
app
=
nextServer
({
dir
:
join
(
__dirname
,
'../'
),
dev
:
false
,
quiet
:
true
,
})
server
=
await
startApp
(
app
)
appPort
=
server
.
address
().
port
})
afterAll
(()
=>
stopApp
(
server
))
it
(
'should render error page'
,
async
()
=>
{
const
browser
=
await
webdriver
(
appPort
,
'/'
)
try
{
await
waitFor
(
2000
)
const
text
=
await
browser
.
elementByCss
(
'#error-p'
).
text
()
expect
(
text
).
toBe
(
'Error Rendered'
)
}
finally
{
await
browser
.
close
()
}
})
})
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