quibble
quibble copied to clipboard
Makes it easy to replace require'd dependencies.
I'm attempting to mock out `node:child_process` using quibble and `tsx` loader at the same time, but it doesn't seem to work. Reproduction here: https://github.com/mehulkar/esm-mock-test
I want to fake the `fs` package using [`memfs`](https://github.com/streamich/memfs). My production code uses [`fs-extra`](https://github.com/jprichardson/node-fs-extra). The require-stack looks like: app.js (ESM) -> fs-extra (CJS) -> graceful-fs (CJS) -> fs (Built-In) ###...
A dependency with ~~`type: "module"` and conditional exports where the `default` is ESM and the `require` is CJS~~ a CJS `exports["."].require` and an ESM `main` will fail with an `ERR_REQUIRE_ESM`...
`quibbleLoaderState.quibbledModules` is initialised as a `Map` in the root of the module, and it is never voided (only replaced with a fresh Map on "reset"), so the empty Map would...
First of all, thank you for this project! It's amazing, I could easily create a mock for both **ESM** and **CJS** with the same code, by just changing from `quibble()`...
Given a module A, which is required by B, which again is required by C, one would expect the following to work: 1. require module B 2. quibble module A...
- Fixes #64 To authors: - when I now run `npm run test:esm` I find a lot of errors saying that modules were not found. I'm confused whether these errors...
I was able to use Quibble alongside SWC with Mocha when running tests for a TypeScript project, as long I kept myself in the realm of Common JS. I have...
Normally, Node throws an error with code `ERR_MODULE_NOT_FOUND` when the requested module is not found. But when the testdouble ESM loader is used, an error with code `ENOENT` is thrown...
Ignore `ignoreCallsFromThisFile` does not work properly After upgrading to version 0.7.0, my tests stopped working. It looks like the paths are not correct. Actually the file path which executes the...