Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tips on using this together with other loaders? #101

Open
fatso83 opened this issue Aug 9, 2023 · 2 comments
Open

Tips on using this together with other loaders? #101

fatso83 opened this issue Aug 9, 2023 · 2 comments

Comments

@fatso83
Copy link

fatso83 commented Aug 9, 2023

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 also successfully ran the same tests as true ESM when un-typescript-ifying the project by running the quibble loader.

Now, I am trying to setup both the SWC loader and the Quibble loader and I am having issues as soon as I run npm test:

RangeError [ERR_UNKNOWN_MODULE_FORMAT]: Unknown module format: undefined for URL file:///Users/carlerik/code/sinon-swc-bug/src/main.spec.ts.mjs?__quibble=0

After unsuccessfully trying to debug the quibble esm loader, I was wondering if there were any hints anywhere on running multiple loaders with Quibble?

Setup:

@gareththegeek
Copy link

I was able to get this working by passing the loader params directly to node rather than via mocha. My take was that mocha only supports one loader but node allows you to specify two:
node --loader ts-node/esm --loader quibble ./node_modules/mocha/bin/mocha

@Ivanca
Copy link

Ivanca commented Dec 5, 2024

This is the first search result when looking into how to use mocha, tsx and doubletest, so if you are here for that this way works:

node --loader testdouble ./node_modules/mocha/bin/mocha.js --import tsx 

You need node 20.11 or greater for this to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants