3 ms·
Jest[1], the JavaScript testing framework used at Facebook attempts to lessen two of the mentionned impacts of TDD > TDD works best with fast tests and rapid f
by vjeux 12y ago
Jest[1], the JavaScript testing framework used at Facebook attempts to lessen two of the mentionned impacts of TDD
> TDD works best with fast tests and rapid feedback. In search of speed, some people use mocks in a way that locks their production code in place. Ironically, this makes refactoring very difficult, which prevents designs from being improved.
Jest automatically generates mocks for you. This reduces the cost invested in writing mocks and therefore lessen the burden of refactoring your code. But if you change the interface of your module, the generated mock will change and break all the tests that depends on it. Which is good!
> Also in search of speed, some people make very elaborate dependency-injection tools and structures, as well as unnecessary interfaces or classes, just so they can mock out dependencies for testing. This leads to overly complex, hard to understand code.
By mocking at the module system level, most of your code is able to be mocked without doing important refactoring.
[1] http://facebook.github.io/jest/ http://facebook.github.io/jest/