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
0117e2b3
Commit
0117e2b3
authored
Feb 26, 2018
by
Arunoda Susiripala
Committed by
Tim Neutkens
Feb 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test case on error recovery in the module scope. (#3892)
This is a test case related for #3888
parent
9e39dd2f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
2 deletions
+32
-2
hmr.js
test/integration/basic/test/hmr.js
+32
-2
No files found.
test/integration/basic/test/hmr.js
View file @
0117e2b3
...
...
@@ -16,8 +16,8 @@ async function check (contentFn, regex) {
export
default
(
context
,
render
)
=>
{
describe
(
'Hot Module Reloading'
,
()
=>
{
describe
(
'
syntax error
'
,
()
=>
{
it
(
'should detect
the error
and recover'
,
async
()
=>
{
describe
(
'
errors
'
,
()
=>
{
it
(
'should detect
syntax errors
and recover'
,
async
()
=>
{
const
browser
=
await
webdriver
(
context
.
appPort
,
'/hmr/about'
)
const
text
=
await
browser
.
elementByCss
(
'p'
).
text
()
...
...
@@ -73,6 +73,36 @@ export default (context, render) => {
browser
.
close
()
})
it
(
'should detect runtime errors on the module scope'
,
async
()
=>
{
const
browser
=
await
webdriver
(
context
.
appPort
,
'/hmr/about'
)
const
text
=
await
browser
.
elementByCss
(
'p'
).
text
()
expect
(
text
).
toBe
(
'This is the about page.'
)
const
aboutPagePath
=
join
(
__dirname
,
'../'
,
'pages'
,
'hmr'
,
'about.js'
)
const
originalContent
=
readFileSync
(
aboutPagePath
,
'utf8'
)
const
erroredContent
=
originalContent
.
replace
(
'export'
,
'aa=20;
\
nexport'
)
// change the content
writeFileSync
(
aboutPagePath
,
erroredContent
,
'utf8'
)
await
check
(
()
=>
browser
.
elementByCss
(
'body'
).
text
(),
/aa is not defined/
)
// add the original content
writeFileSync
(
aboutPagePath
,
originalContent
,
'utf8'
)
await
check
(
()
=>
browser
.
elementByCss
(
'body'
).
text
(),
/This is the about page/
)
browser
.
close
()
})
})
describe
(
'delete a page and add it back'
,
()
=>
{
...
...
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