After Joshua, who carefully followed what God told him to do, died God intentionally left part of the Promised Land unconquered. In Judges 3, it tells whether or not the Israelites chose to follow God.
Joshua 2 ~
20 So the Lord burned with anger against Israel. He said, “Because these people have violated my covenant, which I made with their ancestors, and have ignored my commands, 21 I will no longer drive out the nations that Joshua left unconquered when he died. 22 I did this to test Israel—to see whether or not they would follow the ways of the Lord as their ancestors did.” 23 That is why the Lord left those nations in place. He did not quickly drive them out or allow Joshua to conquer them all.
Joshua 3 ~
3 These are the nations that the Lord left in the land to test those Israelites who had not experienced the wars of Canaan. 2 He did this to teach warfare to generations of Israelites who had no experience in battle. 3 These are the nations: the Philistines (those living under the five Philistine rulers), all the Canaanites, the Sidonians, and the Hivites living in the mountains of Lebanon from Mount Baal-hermon to Lebo-hamath. 4 These people were left to test the Israelites—to see whether they would obey the commands the Lord had given to their ancestors through Moses.
5 So the people of Israel lived among the Canaanites, Hittites, Amorites, Perizzites, Hivites, and Jebusites, 6 and they intermarried with them. Israelite sons married their daughters, and Israelite daughters were given in marriage to their sons. And the Israelites served their gods.