Usul al-Kafi
Book 4:
The Book of Divine Proof

Chapter 83
On the proving of Imamate

458. 2. Imam Jafar as-Sadiq (p) was heard by Ibn Ali Yafur saying: Woe to the oppressors among the Arabs, for an event which is coming near.
Yafur: How many Arabs will there be with the Hujjat al-Qaim (p)?
The Imam (p): An insignificant group.
Yafur: By God, there are a great many who speak about this event.
The Imam (p): The people must be tested, separated and sorted out, and a great many of them will be excluded.

459. 3. Imam Jafar as-Sadiq (p) said to Mansur: O Mansur, this event (the reappearance of Hujjat) will only occur after the people have despaired. By God, not until they (the Muslims) have been sorted out; not until they have been proved; and not until the wretched are proved to be wretched and the blissful proved to be happy.