Bird
0
0

What will happen if you forget to call `super()` in a custom Passport strategy class extending `PassportStrategy`?

medium📝 component behavior Q5 of 15
NestJS - Authentication
What will happen if you forget to call `super()` in a custom Passport strategy class extending `PassportStrategy`?
AThe strategy will not be registered and cause runtime errors
BThe strategy will work normally without issues
CNestJS will automatically call super() for you
DThe application will fail to compile
Step-by-Step Solution
Solution:
  1. Step 1: Understand class inheritance

    Extending PassportStrategy requires calling super() to initialize base class.
  2. Step 2: Consequence of missing super()

    Without super(), the strategy setup fails causing runtime errors.
  3. Final Answer:

    The strategy will not be registered and cause runtime errors -> Option A
  4. Quick Check:

    Missing super() = runtime error [OK]
Quick Trick: Always call super() in constructor of PassportStrategy subclass [OK]
Common Mistakes:
  • Assuming NestJS calls super() automatically
  • Thinking missing super() causes compile error
  • Believing strategy works without super()

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NestJS Quizzes