To cook the pasta: In a large saucepan of boiling salted water cook the pasta as per packet instructions. Drain through a colander or sieve reserving a couple of tablespoons of the cooking water. Return the pasta to the saucepan.
To make the sauce: While the pasta is cooking add a tablespoon of oil to a large frying pan over a medium-high heat. Add the onion and cook for 4-5 minutes until golden. Add the bacon and cook for a couple of minutes. Add the mushrooms and cook for a further 5 minutes. Then add the tomatoes. Stir well and allow to cook for 2-3 minutes until they begin to wilt.
Add this mixture to the pasta to the saucepan. Stir, then add the pesto and approximately 50mls of the reserved cooking liquid. Mix well. Taste and season as necessary.
To serve: Divide the mixture between four pasta bowls and sprinkle over the basil leaves and pine nuts.