avajs / ava

Node.js test runner that lets you develop with confidence 🚀
MIT License
20.73k stars 1.4k forks source link

Add `filterNodeArgumentsForWorkerThreads` option #3336

Closed bojavou closed 1 month ago

bojavou commented 2 months ago

Adds a configuration option threadArgumentsFilter for filtering nodeArguments sent to worker threads. The option is supported only in config files due to accepting a function. When threads are disabled, the filter is ignored and the full unfiltered list of arguments is sent to worker processes.

main is currently failing tests. This patch adds no new failures. All new tests pass. The new feature is documented in 06-configuration.md.

This enabled me to use natives syntax in threads.

Closes #3207.

bojavou commented 2 months ago

This check is failing:

Install and test AVA / Install dependencies without using a lockfile (pull_request)

I'm not clear why, and the new tests passed in the log. Is it possible this failure is unrelated?

novemberborn commented 1 month ago

The Linux tests compare reporter output against a known-good version. That specific suite only runs on Linux because it's finicky enough as it is, without adding other environments into the mix.

However, it's failing through what looks like a change in this PR:

  ✘ Internal error
  TypeError: execArgv is not iterable

  TypeError: execArgv is not iterable
      at createWorker (/lib/fork.js:49:18)
      at loadFork (/lib/fork.js:79:39)
      at pMap.concurrency.concurrency (/lib/api.js:285:20)
      at /node_modules/p-map/index.js:109:26
bojavou commented 1 month ago

Not really sure what to change here but I'm moving toward an internal test runner anyway so I'm just dropping it.

novemberborn commented 1 month ago

That's fine, I can take over.