Open novemberborn opened 2 years ago
Since the error is initiated by worker_threads.Worker()
in https://github.com/avajs/ava/blob/ada1a4f8876ad7b2476440609691e301a02f3951/lib/fork.js#L24
I think the main process has to stop forking worker for the rest of the test files and then print appropriate error message, otherwise we will get aggregated error with same error messages.
But I am afraid, by changing stopOnError
to true
in https://github.com/avajs/ava/blob/ada1a4f8876ad7b2476440609691e301a02f3951/lib/api.js#L302 will change the behavior completely.
Second approach: Check if the error is ERR_WORKER_INVALID_EXEC_ARGV
in https://github.com/avajs/ava/blob/ada1a4f8876ad7b2476440609691e301a02f3951/lib/api.js#L309 and then add warnWorkerThreadError: true
property to the emitted internal-error
event, so the reporter can display a warning message.
What's your opinion?
We could also check whether worker threads are enabled (in AVA's config) and then create a worker. If that fails with a recognized error we don't run the tests at all.
The worker can be created with the eval
option and an empty script, so that we don't have to actually run anything.
See also https://github.com/avajs/ava/issues/3207.
See discussion in https://github.com/avajs/ava/pull/3015. Certain Node.js flags stop worker threads from working. We should recognize that error (
ERR_WORKER_INVALID_EXEC_ARGV
) and print a useful error message so users know to disable worker threads in AVA.