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
3246274d
Unverified
Commit
3246274d
authored
Dec 30, 2020
by
Joe Haddad
Committed by
GitHub
Dec 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(build): require test files be full name or extension (#20605)
Fixes #19935
parent
a03f1f38
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
1 deletion
+50
-1
runTypeCheck.ts
packages/next/lib/typescript/runTypeCheck.ts
+11
-1
contest.tsx
test/integration/typescript-filtered-files/pages/contest.tsx
+3
-0
index.test.js
.../integration/typescript-filtered-files/test/index.test.js
+17
-0
tsconfig.json
test/integration/typescript-filtered-files/tsconfig.json
+19
-0
No files found.
packages/next/lib/typescript/runTypeCheck.ts
View file @
3246274d
...
@@ -33,7 +33,17 @@ export async function runTypeCheck(
...
@@ -33,7 +33,17 @@ export async function runTypeCheck(
})
})
const
result
=
program
.
emit
()
const
result
=
program
.
emit
()
const
regexIgnoredFile
=
/
[\\/]
__
(?:
tests|mocks
)
__
[\\/]
|
(?:
spec|test
)\.[^\\/]
+$/
// Intended to match:
// - pages/test.js
// - pages/apples.test.js
// - pages/__tests__/a.js
//
// But not:
// - pages/contest.js
// - pages/other.js
// - pages/test/a.js
//
const
regexIgnoredFile
=
/
[\\/]
__
(?:
tests|mocks
)
__
[\\/]
|
(?<
=
[\\/
.
])(?:
spec|test
)\.[^\\/]
+$/
const
allDiagnostics
=
ts
const
allDiagnostics
=
ts
.
getPreEmitDiagnostics
(
program
)
.
getPreEmitDiagnostics
(
program
)
.
concat
(
result
.
diagnostics
)
.
concat
(
result
.
diagnostics
)
...
...
test/integration/typescript-filtered-files/pages/contest.tsx
0 → 100644
View file @
3246274d
// Below type error is intentional, it helps check that we don't filter this
// file out because it's named con(test).js
export
default
():
boolean
=>
'Index page'
test/integration/typescript-filtered-files/test/index.test.js
0 → 100644
View file @
3246274d
/* eslint-env jest */
import
{
nextBuild
}
from
'next-test-utils'
import
{
join
}
from
'path'
jest
.
setTimeout
(
1000
*
60
*
2
)
const
appDir
=
join
(
__dirname
,
'..'
)
describe
(
'TypeScript filtered files'
,
()
=>
{
it
(
'should fail to build the app with a file named con*test*.js'
,
async
()
=>
{
const
output
=
await
nextBuild
(
appDir
,
[],
{
stdout
:
true
,
stderr
:
true
})
expect
(
output
.
stdout
).
not
.
toMatch
(
/Compiled successfully/
)
expect
(
output
.
code
).
toBe
(
1
)
expect
(
output
.
stderr
).
toMatch
(
/Failed to compile/
)
expect
(
output
.
stderr
).
toMatch
(
/is not assignable to type 'boolean'/
)
})
})
test/integration/typescript-filtered-files/tsconfig.json
0 → 100644
View file @
3246274d
{
"compilerOptions"
:
{
"esModuleInterop"
:
true
,
"module"
:
"esnext"
,
"jsx"
:
"preserve"
,
"target"
:
"es5"
,
"lib"
:
[
"dom"
,
"dom.iterable"
,
"esnext"
],
"allowJs"
:
true
,
"skipLibCheck"
:
true
,
"strict"
:
true
,
"forceConsistentCasingInFileNames"
:
true
,
"noEmit"
:
true
,
"moduleResolution"
:
"node"
,
"resolveJsonModule"
:
true
,
"isolatedModules"
:
true
},
"exclude"
:
[
"node_modules"
],
"include"
:
[
"next-env.d.ts"
,
"components"
,
"pages"
]
}
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