Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:3:179

Allah would not leave the believers in that ˹state˺ you are in ˹presently˺ until He separates the evil from the good. Nor would Allah reveal to you the unseen. But ˹instead˺, Allah chooses of His messengers whom He wills, so believe in Allah and His messengers. And if you believe and fear Him, then for you is a great reward.  

It is not God’s purpose to leave, to abandon, the believers in the state in which you, O people, are, where the sincere are intermingled with those otherwise, till He shall distinguish (read yamīza or yumayyiza), ˹till˺ He separates, the evil one, the hypocrite, from the good, the believer, through the burdensome obligations that will reveal this ˹distinction˺ — He did this on the Day of Uhud. And it is not God’s purpose to apprise you of the Unseen, so that you could recognise the hypocrites from the others, before the distinguishing; but God chooses, He selects, of His messengers whom He will, apprising him of ˹some of˺ His Unseen, as when He apprised the Prophet (s) of the position of the hypocrites. So believe in God and His messengers; and if you believe and guard against, hypocrisy, then yours shall be a great wage.
القرآن:٣:١٧٩

مَا كَانَ اللَّهُ لِيَذَرَ الْمُؤْمِنِينَ عَلَىٰ مَا أَنْتُمْ عَلَيْهِ حَتَّىٰ يَمِيزَ الْخَبِيثَ مِنَ الطَّيِّبِ ۗ وَمَا كَانَ اللَّهُ لِيُطْلِعَكُمْ عَلَى الْغَيْبِ وَلَٰكِنَّ اللَّهَ يَجْتَبِي مِنْ رُسُلِهِ مَنْ يَشَاءُ ۖ فَآمِنُوا بِاللَّهِ وَرُسُلِهِ ۚ وَإِنْ تُؤْمِنُوا وَتَتَّقُوا فَلَكُمْ أَجْرٌ عَظِيمٌ  

{ما كان الله ليذر} ليترك {المؤمنين على ما أنتم} أيها الناس {عليه} من اختلاط المخلص بغيره {حتى يَمِيزَ} بالتخفيف والتشديد يفصل {الخبيث} المنافق {من الطيب} المؤمن بالتكاليف الشاقة المبينة لذلك ففعل ذلك يوم أحد {وما كان الله ليطلعكم على الغيب} فتعرفوا المنافق من غيره قبل التمييز {ولكنَّ الله يجتبي} يختار {من رسله من يشاء} فيطلعه على غيبه كما أطلع النبي ﷺ على حال المنافقين {فآمنوا بالله ورسله وإن تؤمنوا وتتقوا} النفاق {فلكم أجر عظيم}.