小编Osc*_*anz的帖子

Jest 测试套件无法运行:“分段错误(核心转储)”或“Jest 工作进程 (pid=xxx) 被另一个进程终止”

我正在创建一个 Express API,一切都很顺利,直到我开始遇到一些测试问题。我使用 Jest 和 Supertest 来测试端点,但我不知道为什么在运行测试时开始出现此消息。

\n
 FAIL  src/modules/ingredients/tests/updateingredient.test.ts\n  \xe2\x97\x8f Test suite failed to run\n\n    A jest worker process (pid=672269) was terminated by another process: signal=SIGSEGV, exitCode=null. Operating system logs may contain more information on why this occurred.\n\n      at ChildProcessWorker._onExit (node_modules/jest-worker/build/workers/ChildProcessWorker.js:366:23)\n\n(node:672290) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 open listeners added to [_0x323dee]. Use emitter.setMaxListeners() to increase limit\n(Use `node --trace-warnings ...` to show where the warning was created)\n
Run Code Online (Sandbox Code Playgroud)\n

我正在使用 Redis 进行缓存和速率限制,我知道它必须与其相关,但我不知道如何修复它。这些错误仅在端点测试时发生。最奇怪的是,这些错误仅在我在 VSCode 打开的情况下运行测试时显示,当我从外部终端运行测试并且 VSCode 关闭时,所有测试都会通过。

\n

我已经使用 --detectOpenHandles …

redis node.js express typescript jestjs

5
推荐指数
0
解决办法
1020
查看次数

标签 统计

express ×1

jestjs ×1

node.js ×1

redis ×1

typescript ×1