Preheat the oven to 355F / 180C and line a deep 9 x 12 inch (or similar) sheet pan or baking pan with baking paper**.
In a large bowl, blend a little of the milk into the flour so that there are no lumps, then whisk in the eggs, then the rest of the milk.
Melt the butter in a frying pan, then pan fry the mushrooms until most of the water has evaporated. Remove from the heat to cool a bit.
Meanwhile, add all of the other ingredients (apart from the optional ingredients) to the egg and milk mixture, reserving about 1/3 of the cheese. Add the slightly cooled mushrooms.
Mix well, then tip into the pan and smooth over. Sprinkle over the reserved cheese, then dollop the pesto evenly over the top (if using).
Bake for 25 to 30 minutes or until the frittata is cooked but still slightly wobbly. Remove from the oven and let cool for 15 minutes before cutting into 9-12 squares or rectangles.