TypeError: Expected throat size to be a number but got undefined

TypeError: Expected throat size to be a number but got undefined

我正在尝试使用 jest-circus runner with jest。如果没有跑步者,测试会正确执行,但只要我添加以下行:

  'testRunner': 'jest-circus/runner',

到我的笑话配置。我看到以下错误:

 FAIL  migration.test.js
 ● Test suite failed to run

TypeError: Expected throat size to be a number but got undefined

  at throat (node_modules/throat/index.js:34:13)
  at Object.<anonymous>.module.exports (node_modules/throat/index.js:76:12)

这个错误是什么意思?我在配置中遗漏了什么吗?

这是我的完整配置:

'use strict';

module.exports = {
  'verbose': true,
  'globalSetup': './tests/setup.js',
  'globalTeardown': './tests/teardown.js',
  'testEnvironment': './CustomNodeEnvironment.js',
  'setupTestFrameworkScriptFile': './jest.setup.js',
  'testMatch': [ '**/?(*.)test.js?(x)' ],
  'testRunner': 'jest-circus/runner',
  'reporters': ['default', 'jest-junit', ['jest-junit', {'configValue': true, 'output': '/tmp/junit.xml'}]]
};

这是一个版本兼容性问题。

将 jest 版本 23 与 jest-circus 24 一起使用会出现该错误。所以只需将 jest 升级到版本 24 就可以正常工作了。