禁用 Istanbul 进行 Jest 调试

Disable Istanbul for Jest Debugging

我正在尝试调试一些用 Jest 编写的失败测试。虽然我可以这样做,但附加 chrome 调试器就好了,我注意到 Istanbul 显然一直在工作并且使我的文件更难处理。

有谁知道是否有办法禁用 Istanbul,或者以某种方式让 Node 通过等效于映射文件进行调试?

编辑 这是我正在尝试调试的文件示例。在源代码中,它被称为 handlerFactory.js 但在 chrome 中,我在从我的测试函数介入时最终调试了 VM3376 handlerFactory.js 文件。

/* istanbul ignore next */
cov_6n2doqihv.s[10]++;

const insertCheckins = postgres => {
  /* istanbul ignore next */
  cov_6n2doqihv.f[2]++;
  cov_6n2doqihv.s[11]++;
  return (
    /**
     * Function to insert the records
     * @param  {Object} checkIns The check-in records
     * @return {Promise}
     */
    async checkIns => {
      /* istanbul ignore next */
      cov_6n2doqihv.f[3]++;
      cov_6n2doqihv.s[12]++;
      return Promise.all(checkIns.map(checkin => {
        /* istanbul ignore next */
        cov_6n2doqihv.f[4]++;
        cov_6n2doqihv.s[13]++;
        return insertRecord(postgres)(checkin);
      }));
    }
  );
};

伊斯坦布尔在默认情况下是禁用的,它可能在 package.jsonjest.config.js

的开玩笑配置中启用

要禁用它,您可以删除 configuration

package.json
{
  "jest": {
-    "coverage": true
  }
}

或明确运行 jest 无覆盖

jest --coverage=false

要在 VSCode 中使用 Nodejs 调试器,您可以查看 the documentation or try with this launch.json