Jesus said, “You will know them by their fruits” (see notes below).

bible.com/bible/100/jas.1.22-24.NASB1995

Matthew 7
13“aEnter through the narrow gate; for the gate is wide and the way is broad that leads to destruction, and there are many who enter through it.†‡ 
14“For the gate is small and the way is narrow that leads to life, and there are few who find it.†
15“Beware of the afalse prophets, who come to you in sheep’s clothing, but inwardly are bravenous wolves.† 
16“You will a1know them by their fruits. 2Grapes are not gathered from thorn bushes nor figs from thistles, are they?† 
17“So aevery good tree bears good fruit, but the bad tree bears bad fruit. 
18“A good tree cannot produce bad fruit, nor can a bad tree produce good fruit. 
19“aEvery tree that does not bear good fruit is cut down and thrown into the fire. 
20“So then, you will 1know them aby their fruits. 
21“aNot everyone who says to Me, ‘Lord, Lord,’ will enter the kingdom of heaven, but he who does the will of My Father who is in heaven will enter.† 
22“aMany will say to Me on bthat day, ‘Lord, Lord, did we not prophesy in Your name, and in Your name cast out demons, and in Your name perform many 1miracles?’† 
23“And then I will declare to them, ‘I never knew you; aDEPART FROM ME, YOU WHO PRACTICE LAWLESSNESS.’†
Interpretation
7:13, 14 Both the narrow gate and the wide gate are assumed to provide the entrance to God’s kingdom. Two ways are offered to people. The narrow gate is by faith, only through Christ, constricted and precise. It represents true salvation in God’s way that leads to life eternal. The wide gate includes all religions of works and self-righteousness, with no single way (cf. Ac 4:12), but it leads to hell, not heaven. † 
7:14 way is narrow. Christ continually emphasized the difficulty of following Him (10:38; 16:24, 25; Jn 15:18, 19; 16:1–3; cf. Ac 14:22). Salvation is by grace alone, but is not easy. It calls for knowledge of the truth, repentance, submission to Christ as Lord, and a willingness to obey His will and Word. See notes on 19:16–28. † 
7:15 false prophets. These deceive not by disguising themselves as sheep, but by impersonating true shepherds. They promote the wide gate and the wide way. sheep’s clothing. This may refer to the woolen attire that was the characteristic garb of a shepherd. † 
7:16 You will know them by their fruits. See note on 3:8. False doctrine cannot restrain the flesh, so false prophets manifest wickedness. Cf. 2Pe 2:12–22. † 7:21 Not everyone who says … but he who does. The barrenness of this sort of faith demonstrates its real character (cf. v. 20)—the faith that says but does not do is really unbelief. Jesus was not suggesting that works are meritorious for salvation, but that true faith will not fail to produce the fruit of good works. This is precisely the point of Jas 1:22–25; 2:26.