"And Moses said to the people: Do not fear" (Exodus 20:17). He said to them: He gave you the Torah and performed for you signs and mighty acts only in order to test you, to make you great above all who enter the world, as in the matter that is said, "[Evil-merodach] lifted up [the head of Jehoiachin]" (2 Kings 25:27). Another interpretation: "For it is in order to test you" means to make you great through the commandments, as in the matter that is said, "for they shall be as the stones of a crown, lifted up as an ensign upon His land" (Zechariah 9:16), and it says, "You have given a banner to those who fear You, to be raised on high" (Psalms 60:6). Another interpretation: "For it is in order to test you" means: assuredly, in the past you were unwitting [in sin], now you are deliberate; in the past you did not know the giving of the reward of the righteous and the smiting of the punishment of the wicked in the time to come, now you do know the giving of the reward of the righteous and the smiting of the punishment of the wicked in the time to come. "And that His fear may be upon your faces, so that you do not sin" (Exodus 20:17): whoever has shame upon his face does not quickly come to sin.
Do Not Fear for God Tested You to Raise You Up
Mekhilta DeRabbi Shimon Ben Yochai 20:17
ויאמר משה אל העם אל תיראו אמר להם לא נתן לכם את התורה ולא עשה לכם נסים וגבורות אלא לבעבור נסות אתכם לגדלכם על כל באי העולם כענין שנ' (מ"ב כ"ה כ"ז) נשא אויל מרודך: ד"א כי לבעבור נסות אתכם לגדלכם במצוות כענין שנ' (זכריה ט' ט"ז) כי אבני נזר מתנוססות על אדמתו ואומר (תהלים ס' ו') נתת ליריאך נס להתנוסס: ד"א כי לבעבור נסות אתכם בודאי לשעבר הייתם שוגגין עכשיו מזידין לשעבר לא הייתם יודעין מתן שכרן של צדיקים ומחת פורענותן של רשעים לעתיד לבא: עכשו אתם יודעין מתן שכרן של צדיקים ומחת פורענותן של רשעים לעתיד לבא: ובעבור תהיה יראתו על פניכם לבלתי תחטאו. כל שיש לו בושת פנים לא במהרה הוא חוטא: