To make the pesto, put the basil leaves into the bowl of a food processor. Add the pine nuts.
Chop the parmesan into small chunks and add to the food processor.
Roughly chop the garlic and add to the food processor.
Turn the processor on and process until the basil and cheese are chopped finely. Scrape down the sides of the bowl with a spatula and ensure there are no large chunks remaining - if there are, blend again briefly.
Turn the food processor on again and, with the motor running, add the olive oil in a thin stream through the funnel in the lid.
Check the consistency - it should be thick and just drop off the spatula.
Transfer the pesto into a bowl and cover with cling film until needed. (You can keep it in an airtight jar, covered with a thin layer of olive oil, for a few days in the fridge; or freeze it.)
To cook the pasta, bring a large pan of well-salted water to the boil then add the pasta.
Trofie pasta takes about 15 minutes to cook so, after 8-9 minutes, add the potatoes and carrots and bring back to the boil (if your pasta takes less time to cook you'll need to add the carrots and potatoes sooner).
Allow to boil for a further two more minutes then add the beans and cook for another three minutes.
By the time the trofie is perfectly cooked but still firm (al dente), the vegetables will be nicely cooked. Drain thoroughly and toss the pasta together with the pesto.
Serve with extra parmesan or pecorino and a sprig of fresh basil, if you like.