Conversation
This change was very minimal, mostly changes to the package.json since timecop.js is already exports properly. The build task bumps versions.
|
+1 |
|
i have another commit ready to go it is just dependent on nodejs/node-v0.x-archive#3710 |
|
It looks like that node thread is both very long and very dead. I'm all for making this node-compatible, but it seems that community doesn't like the idea of time travel in tests. |
|
dependency injection for tests is a code smell. |
|
@stevegraham I think what you mean is "The API I want for my Foo library is Am I reading you right? |
|
IMO the latter is bad. The last arg is only there for the sake of testing; the outside world does not need to know about the date inside that function. As an example, JWT tokens depend on time and it's useful to mock time when working with them, e.g. writing code that generates them. Other people may disagree with me, and that's fine, let them use dependency injection in lieu of mocks; but a lot of developers are used to the flexibility that mocks provide and I think that it's bad to remove that option because of the opinions of a vocal subset of developers. |
|
Timecop.js is great and deserves to be a first class npm module. IMHO. |
|
Is there something we can do here to get around the problems that arise from changing |
|
+1 |
This change was very minimal, mostly changes to the package.json since timecop.js is already exports properly. The build task bumps versions.
To test you can either npm install from my master branch or just
require('./timecop')in node in the root of the project.All test pass