avajs / ava

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

Unable to use registerCompletionHandler #3350

Closed mxiao-cll closed 6 days ago

mxiao-cll commented 1 week ago

I was trying to follow this guide: https://github.com/avajs/ava/blob/main/docs/08-common-pitfalls.md#timeouts-because-a-file-failed-to-exit

Here is my change: https://github.com/smartcontractkit/ea-framework-js/pull/309/files

But received the following error:

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/work/ea-framework-js/ea-framework-js/test/_force-exit.mjs not supported.
  Instead change the require of /home/runner/work/ea-framework-js/ea-framework-js/test/_force-exit.mjs to a dynamic import() which is available in all CommonJS modules.
  Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/work/ea-framework-js/ea-framework-js/test/_force-exit.mjs not supported.
  Instead change the require of /home/runner/work/ea-framework-js/ea-framework-js/test/_force-exit.mjs to a dynamic import() which is available in all CommonJS modules.
      at TracingChannel.traceSync (node:diagnostics_channel:315:14)
      at loadRequiredModule (file:///home/runner/work/ea-framework-js/ea-framework-js/node_modules/ava/lib/worker/base.js:198:[11](https://github.com/smartcontractkit/ea-framework-js/actions/runs/11921904641/job/33227039950?pr=309#step:5:12))
      at run (file:///home/runner/work/ea-framework-js/ea-framework-js/node_modules/ava/lib/worker/base.js:221:31)
      at async file:///home/runner/work/ea-framework-js/ea-framework-js/node_modules/ava/lib/worker/base.js:281:2

package.json: https://github.com/smartcontractkit/ea-framework-js/blob/main/package.json#L66 Invoke: https://github.com/smartcontractkit/ea-framework-js/blob/main/package.json#L66