lukeed/uvu

add support for "--loader" and "--no-warning" options for unit-test mocking

iambumblehead opened this issue · 2 comments

to use uvu with esmock one must use something like this,

{
  "test": "node --no-warnings --loader=esmock ./node_modules/uvu/bin.js ./spec/uvu/"
}

instead, it would be nice to use this,

{
  "test": "uvu spec --no-warnings --loader=esmock"
}

if you will accept a PR, I will submit a PR to you and follow your process

There's no way (currently) to forward --loader to the node process & no way to do emulate it the way uvu does with --require hooks.

The only option here would be to have uvu spawn a node process via child_process, which means that there would be 2 node processes active for every uvu ... usage.

I think I'll be updating loadr in the near future so that it will forward any non-loadr arguments to the underlying node process. That means that your example would look like this:

$ loadr --loader=esmock --no-warnings -- uvu spec

this works

NODE_OPTIONS='--loader=esmock' uvu ./spec/