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
ccea1c01
Unverified
Commit
ccea1c01
authored
May 20, 2020
by
Joe Haddad
Committed by
GitHub
May 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable jest/no-try-expect (#13124)
parent
a17ace8e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
16 deletions
+13
-16
.eslintrc.json
.eslintrc.json
+1
-2
index.test.js
test/integration/create-next-app/index.test.js
+2
-0
config.test.js
test/isolated/config.test.js
+6
-14
require-page.test.js
test/isolated/require-page.test.js
+4
-0
No files found.
.eslintrc.json
View file @
ccea1c01
...
...
@@ -26,8 +26,7 @@
"extends"
:
[
"plugin:jest/recommended"
],
"rules"
:
{
"jest/expect-expect"
:
"off"
,
"jest/no-disabled-tests"
:
"off"
,
"jest/no-try-expect"
:
"off"
"jest/no-disabled-tests"
:
"off"
}
},
{
"files"
:
[
"**/__tests__/**"
],
"env"
:
{
"jest"
:
true
}
},
...
...
test/integration/create-next-app/index.test.js
View file @
ccea1c01
...
...
@@ -45,6 +45,7 @@ describe('create next app', () => {
try
{
await
runStarter
(
cwd
,
projectName
)
}
catch
(
e
)
{
// eslint-disable-next-line jest/no-try-expect
expect
(
e
.
stdout
).
toMatch
(
/contains files that could conflict/
)
}
})
...
...
@@ -76,6 +77,7 @@ describe('create next app', () => {
try
{
await
run
(
cwd
,
projectName
,
'--example'
,
'not a real example'
)
}
catch
(
e
)
{
// eslint-disable-next-line jest/no-try-expect
expect
(
e
.
stderr
).
toMatch
(
/Could not locate an example named/i
)
}
expect
(
...
...
test/isolated/config.test.js
View file @
ccea1c01
...
...
@@ -66,16 +66,12 @@ describe('config', () => {
})
it
(
'Should throw when an invalid target is provided'
,
()
=>
{
try
{
expect
(()
=>
{
loadConfig
(
PHASE_DEVELOPMENT_SERVER
,
join
(
__dirname
,
'_resolvedata'
,
'invalid-target'
)
)
// makes sure we don't just pass if the loadConfig passes while it should fail
throw
new
Error
(
'failed'
)
}
catch
(
err
)
{
expect
(
err
.
message
).
toMatch
(
/Specified target is invalid/
)
}
}).
toThrow
(
/Specified target is invalid/
)
})
it
(
'Should pass when a valid target is provided'
,
()
=>
{
...
...
@@ -87,18 +83,14 @@ describe('config', () => {
})
it
(
'Should throw an error when next.config.js is not present'
,
()
=>
{
try
{
expect
(()
=>
loadConfig
(
PHASE_DEVELOPMENT_SERVER
,
join
(
__dirname
,
'_resolvedata'
,
'typescript-config'
)
)
// makes sure we don't just pass if the loadConfig passes while it should fail
throw
new
Error
(
'failed'
)
}
catch
(
err
)
{
expect
(
err
.
message
).
toMatch
(
/Configuring Next.js via .+ is not supported. Please replace the file with 'next.config.js'./
)
}
).
toThrow
(
/Configuring Next.js via .+ is not supported. Please replace the file with 'next.config.js'/
)
})
it
(
'Should not throw an error when two versions of next.config.js are present'
,
()
=>
{
...
...
test/isolated/require-page.test.js
View file @
ccea1c01
...
...
@@ -25,6 +25,7 @@ describe('pageNotFoundError', () => {
try
{
throw
pageNotFoundError
(
'test'
)
}
catch
(
err
)
{
// eslint-disable-next-line jest/no-try-expect
expect
(
err
.
code
).
toBe
(
'ENOENT'
)
}
})
...
...
@@ -89,6 +90,7 @@ describe('requirePage', () => {
try
{
await
requirePage
(
'/../../test'
,
distDir
)
}
catch
(
err
)
{
// eslint-disable-next-line jest/no-try-expect
expect
(
err
.
code
).
toBe
(
'ENOENT'
)
}
})
...
...
@@ -98,6 +100,7 @@ describe('requirePage', () => {
try
{
await
requirePage
(
'/non-existent'
,
distDir
)
}
catch
(
err
)
{
// eslint-disable-next-line jest/no-try-expect
expect
(
err
.
code
).
toBe
(
'ENOENT'
)
}
})
...
...
@@ -107,6 +110,7 @@ describe('requirePage', () => {
try
{
await
requirePage
(
'/non-existent-child'
,
distDir
)
}
catch
(
err
)
{
// eslint-disable-next-line jest/no-try-expect
expect
(
err
.
code
).
toBe
(
'MODULE_NOT_FOUND'
)
}
})
...
...
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