How to configure unhandled-rejections for jest in bazel

117 Views Asked by At

The below configuration in npmrc file suppresses the error for unhandledPromiseRejection after migration from node 14 to node 16.

.npmrc node-options="--unhandled-rejections=none"

But in bazel using jest_test, unsure where to configure this. Can we do it with jest_test or package.json or jest.config.js

How and what is the appropriate way to do this?

tried to import .npmrc file in npm_install of rules_nodejs library with version 5.x version. But it is just copying registry url and ignoring other configs.

Is that a permission issue or if rules_nodejs npmrc is getting overridden? or anything else i am missing here?

What is the right way to suppress this error in jest_test in bazel with jest_cli

1

There are 1 best solutions below

0
On BEST ANSWER

Handled from jest.config.ts

setupFiles: ['<rootDir>/.jest/handleErrors.js'],

handleErrors.js

process.on('unhandledRejection', reason => {
  return;
});