They were left to test Israel, to see whether Israel would obey the commands Yahweh had given their fathers through Moses.
In context
2this was only so that the generations of the Israelites would learn war, at least those who had not known it before: 3the five lords of the Philistines, all the Canaanites, the Sidonians, and the Hivites living in the mountains of Lebanon, from Mount Baal-hermon to Lebo-hamath. 4They were left to test Israel, to see whether Israel would obey the commands Yahweh had given their fathers through Moses. 5So the Israelites lived among the Canaanites, the Hittites, the Amorites, the Perizzites, the Hivites, and the Jebusites. 6They took the daughters of these peoples as wives for themselves and gave their own daughters to their sons, and they served their gods.