testdouble.js
testdouble.js copied to clipboard
A minimal test double library for TDD with JavaScript
If td.explain is passed an object, it should loop over the functions and, if any test double functions are found, should report some rollup stats (e.g. "my name is this,...
This would allow `throw td.explain(foo)` to print in a naturally helpful way. Also thinking the explain return value should have description == .toString() Thoughts?
### Description It's useful to test what arguments it was nth called with. In my case is when I implement Jest matcher (`toHaveBeenLastCalledWith`, `toHaveBeenNthCalledWith `) for testdouble. ### Example Repo...
_Upon re-reading the documentation, I figured out what I was doing wrong._ That said, I found it surprising that `td.matchers.contains(['some', 'array', 'elements'])` did _not_ work, even though both `td.matchers.contains('some', 'array',...
Surprisingly, `td.object({ something() {} })` and `td.object(['something'])` produce different results; the latter is an Array. ``` > td.object({ something() {} }).splice undefined > td.object(['something']).splice [Function: splice] ```
`td.explain` on a double _after_ `td.reset` reports that it is not a double. It still is, and invoking the double still logs the call as expected. (And once the double...
See #324 for more details, specifically to support [this case](https://github.com/arelra/testdouble-issue-324-symlink-module-regression), in which a user runs tests from the top-level directory. AFAICT, any references to "symlinks" are a red herring, the...
Currently the docs are quite hard to search through, because they lack a proper navigation menu in each page, it's only in the README.md. Since you are using markdown for...
This _may_ not be all that valuable, since captors are nearly a plain object anyway. But it would be nice to have a helpful descriptive output for captors that showed...
In my opinion, the following should be an error: ```js const Constructor = td.constructor(function () {}); Constructor(); // should throw, complaining it is not called with new ``` This would...