Bring a large pot of salted water to a simmer. Add the gnocchi and cook until they float, about 2 minutes.
Reserve 1/4 cup of the cooking water, then drain the gnocchi in a colander.
Heat 1–2 tablespoons butter in a skillet over medium heat. Add the drained gnocchi and cook, stirring occasionally, until lightly golden, 3–5 minutes.
Stir 1/3 cup pesto and 1/2 cup heavy cream into the skillet and bring to a gentle simmer.
Simmer until the sauce slightly thickens, about 1 minute. If the sauce is too thick, thin with 1–2 tablespoons of the reserved pasta water.
Season with salt and pepper to taste and serve immediately.