testdouble.js
testdouble.js copied to clipboard
A minimal test double library for TDD with JavaScript
### Description I am already running my tests with `--loader=ts-node/esm` to handle TypeScript to ESM compilation and writing my tests in TypeScript. How can I now plug in `Testdouble` to...
### Description In a TypeScript code base, `thenReject()` only accepts `Error`s. ### Issue It would be nice to allow for different types of rejected values – along the lines of...
### Description In the testdouble repo, I created `examples/node-esm/test/lib/numbers-only-test.mjs` with the following code. ```javascript import assert from 'assert' import mocha from 'mocha' import * as td from 'testdouble' mocha.describe('numbers-only', function...
I have an angular app, and `testdouble` in my `devDependencies` of my package file. When I try to run my angular test suite, I am getting: `./node_modules/testdouble/lib/can-register-loader.js:1:15-32 - Error: Module...
### Description Mocking ESM works under Node 20 but not under Node 21 ### Issue ES Module mocking does not appear to be working under Node 21. ### Environment -...
In many cases, spies are re-useable, so they can be set up at the root of the test. When asserting cases where a spy may or may not have been...
### Description Running 800 unit tests using testdouble, resulting in memory leak. ### Issue There are many testdouble usages that do not seem to be deleting properly. Therefore, when building...
Hello, [npm-run-all](https://www.npmjs.com/search?q=npm-run-all) is a useful but no longer maintained development dependency. ### Proposed Solution Change npm-run-all to [npm-run-all2](https://github.com/bcomnes/npm-run-all2), a currently maintained and improved fork. The change is as simple as...
`sample.js` ``` export {a, b} function a() { return b() } function b() { return 'b' } ``` > want to replace `b()` but preserve `a()`... `td.test.js` ``` import test...