DEV Community

Discussion on: Don´t use Singleton Pattern in your unit tests

Collapse
lexlohr profile image
Alex Lohr

You can still use new mySingleton.constructor() for testing purposes if your singleton has persistent states. Yes, it's a tiny bit less elegant. No, it's not impossible to use a singleton in TDD.