未验证 提交 00d930aa 编写于 作者: J JJ Kasper 提交者: GitHub

Add additional file serving tests (#12479)

* Test `static/` file name encoding

* Fix `static/` file name encoding

* Add additional file-serving tests

* bump
Co-authored-by: NJoe Haddad <joe.haddad@zeit.co>
上级 3af0fe5c
......@@ -272,9 +272,21 @@ export default class DevServer extends Server {
}
protected async hasPage(pathname: string): Promise<boolean> {
let normalizedPath: string
try {
normalizedPath = normalizePagePath(pathname)
} catch (err) {
console.error(err)
// if normalizing the page fails it means it isn't valid
// so it doesn't exist so don't throw and return false
// to ensure we return 404 instead of 500
return false
}
const pageFile = await findPageFile(
this.pagesDir!,
normalizePagePath(pathname),
normalizedPath,
this.nextConfig.pageExtensions
)
return !!pageFile
......
this is used for traverse testing
\ No newline at end of file
this is used for traverse testing
\ No newline at end of file
因为 它太大了无法显示 source diff 。你可以改为 查看blob
this is used for traverse testing
\ No newline at end of file
......@@ -172,7 +172,10 @@ export function runNextCommandDev(argv, stdOut, opts = {}) {
if (typeof opts.onStdout === 'function') {
opts.onStdout(message)
}
process.stdout.write(message)
if (opts.stdout !== false) {
process.stdout.write(message)
}
}
function handleStderr(data) {
......@@ -180,7 +183,10 @@ export function runNextCommandDev(argv, stdOut, opts = {}) {
if (typeof opts.onStderr === 'function') {
opts.onStderr(message)
}
process.stderr.write(message)
if (opts.stderr !== false) {
process.stderr.write(message)
}
}
instance.stdout.on('data', handleStdout)
......
this is used for traverse testing
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册