Fix some greptile things

This commit is contained in:
Tom Coleman 2024-12-16 22:32:07 +11:00
parent 7a3e991a2d
commit f94f7d9fc8
3 changed files with 10 additions and 5 deletions

View File

@ -16,8 +16,8 @@ export async function execCommandCountLines(
) {
const process = execaCommand(command, { shell: true, buffer: false, ...options });
if (!process.stdout) {
// Return undefined rather than throwing an error
return undefined;
// eslint-disable-next-line local-rules/no-uncategorized-errors
throw new Error('Unexpected missing stdout');
}
let lineCount = 0;
@ -29,5 +29,7 @@ export async function execCommandCountLines(
// If the process errors, this will throw
await process;
rl.close();
return lineCount;
}

View File

@ -2,7 +2,7 @@ import { expect, it } from 'vitest';
import { getHasRouterPackage } from './get-has-router-package';
it('returns true if there is a routing package in package.json', async () => {
it('returns true if there is a routing package in package.json', () => {
expect(
getHasRouterPackage({
dependencies: {
@ -14,7 +14,7 @@ it('returns true if there is a routing package in package.json', async () => {
).toBe(true);
});
it('returns false if there is a routing package in package.json dependenices', async () => {
it('returns false if there is a routing package in package.json dependencies', () => {
expect(
getHasRouterPackage({
dependencies: {

View File

@ -16,7 +16,10 @@ export const runTelemetryOperation = async <T>(cacheKey: string, operation: () =
let cached = await cache.get<T>(cacheKey);
if (cached === undefined) {
cached = await operation();
await cache.set(cacheKey, cached);
// Undefined indicates an error, setting isn't really valuable.
if (cached !== undefined) {
await cache.set(cacheKey, cached);
}
}
return cached;
};