Fix build function to detect test projects