diff --git a/endpoints/codecov.ts b/endpoints/codecov.ts index 9de96dd..48e7841 100644 --- a/endpoints/codecov.ts +++ b/endpoints/codecov.ts @@ -40,6 +40,14 @@ async function handler ({ vcs, owner, repo, branch }: Args) { const endpoint = `https://codecov.io/api/${args.join('/')}` const data = await got(endpoint).then(res => res.body) + if (!data.commit) { + return { + subject: 'codecov', + status: 'unknown', + color: 'grey' + } + } + return { subject: 'coverage', status: coverage(data.commit.totals.c), diff --git a/endpoints/github.ts b/endpoints/github.ts index b9a1a1d..7edcd1e 100644 --- a/endpoints/github.ts +++ b/endpoints/github.ts @@ -265,7 +265,7 @@ const makeRepoQuery = (topic, owner, repo, restArgs) => { } ` - return queryGithub(query).then(res => res.data.repository) + return queryGithub(query).then(res => res.data!.repository) } } diff --git a/endpoints/npm.ts b/endpoints/npm.ts index 3baa900..4b20a86 100644 --- a/endpoints/npm.ts +++ b/endpoints/npm.ts @@ -120,7 +120,7 @@ const download = async (period, npmName, tag = 'latest') => { const { downloads } = await got(endpoint.join('/')).then( res => res.body, - err => err.response.statusCode === 404 && { downloads: 0 } + err => err.response!.statusCode === 404 && { downloads: 0 } ) const count = typeof downloads === 'number'