connor4312 / nodejs-testing

VS Code integration for node:test native tests
MIT License
50 stars 7 forks source link

Support for additional node flags like --loader #10

Closed Magoli1 closed 1 year ago

Magoli1 commented 1 year ago

Hey 😀

I am wondering if there is any option to provide additional node flags like --loader to this plugin? In my case, I usually use something like node --loader esmock [...] to start my tests. Any hint is highly appreciated!

Cheers 🚀 Robert

Magoli1 commented 1 year ago

Kinda related: https://github.com/connor4312/nodejs-testing/issues/4

daKmoR commented 1 year ago

I think this could be solved by adding an additional setting and then passing that along to

https://github.com/connor4312/nodejs-testing/blob/17a5620b44e4a250a5d24f49c7e429581cc4d17e/src/runner.ts#L190

The options could be named nodejsParams and would be similar to the existing nodejs-testing.include.

probably supporting the launch variable like ${workspaceFolder} would make sense so you could then set it like so

nodejsParams Array:

  1. --import
  2. ${workspaceFolder}/my-file.js
  3. --loader
  4. esmock

and then we could just pass it along to the spawn

such a feature would solve this and #8

@connor4312 shall I prepare a Pull Request for this feature?

connor4312 commented 1 year ago

Sure, I'd be happy to take a PR, just haven't had a lot of time to work on this recently.

daKmoR commented 1 year ago

nice - I will start working on it 👍

connor4312 commented 1 year ago

Published in 1.1.0