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 pasta 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.
Reduce heat to medium-low and add 1/3 cup pesto and 1/2 cup heavy cream to the skillet. Stir to combine and bring to a light simmer.
Simmer until the sauce slightly thickens, about 1 minute. If the sauce is too thick, stir in 1–2 tablespoons of the reserved pasta water to loosen it.
Season with salt and pepper to taste, toss to coat, and serve immediately.