【发布时间】:2020-10-31 23:36:42
【问题描述】:
我正在尝试在本地运行 TypeORM 测试。我正在使用 Docker 镜像来运行所有数据库,只需运行:
docker-compose up
我将ormconfig.json.dist 复制到ormconfig.json,然后运行:
npm run compile ; npm run test
它因这个错误而崩溃:
> npm run compile ; npm run test
> typeorm@0.2.25 compile C:\Users\pupeno\Documents\Flexpoint Tech\js\typeorm
> rimraf ./build && tsc
> typeorm@0.2.25 test C:\Users\pupeno\Documents\Flexpoint Tech\js\typeorm
> rimraf ./build && tsc && mocha --file ./build/compiled/test/utils/test-setup.js --bail --recursive --timeout 60000 ./build/compiled/test
√ github issues > #3158 Cannot run sync a second time (475ms)
√ github issues > #3588 Migration:generate issue with onUpdate using mysql 8.0 (116ms)
benchmark > bulk-save > case1
connecting
1) "before all" hook for "testing bulk save of 10.000 objects"
2) "after all" hook for "testing bulk save of 10.000 objects"
2 passing (1m)
2 failing
1) benchmark > bulk-save > case1
"before all" hook for "testing bulk save of 10.000 objects":
Error: Timeout of 60000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (C:\Users\pupeno\Documents\Flexpoint Tech\js\typeorm\build\compiled\test\benchmark\bulk-save-case1\bulk-save-case1.js)
at listOnTimeout (internal/timers.js:551:17)
at processTimers (internal/timers.js:494:7)
2) benchmark > bulk-save > case1
"after all" hook for "testing bulk save of 10.000 objects":
TypeError: Cannot read property 'map' of undefined
at Object.closeTestingConnections (test\utils\test-utils.ts:285:36)
at Context.<anonymous> (test\benchmark\bulk-save-case1\bulk-save-case1.ts:16:17)
at processImmediate (internal/timers.js:458:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! typeorm@0.2.25 test: `rimraf ./build && tsc && mocha --file ./build/compiled/test/utils/test-setup.js --bail --recursive --timeout 60000 ./build/compiled/test`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the typeorm@0.2.25 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\pupeno\scoop\persist\nodejs\cache\_logs\2020-07-11T09_15_28_115Z-debug.log
尝试调试正在发生的事情,据我所见,连接到 PostgreSQL 数据库时超时,但其他数据库似乎工作并使用与 @ 中相同的凭据连接到我的 PSQL 客户端 (DataGrip) 987654328@ 也可以。
我尝试的另一件事是不启动 docker 映像,而是启动我自己的本地 PostgreSQL,使用正确的凭据设置用户和数据库并尝试运行测试。同样的错误。
我正在构建一个使用 TypeORM 并成功连接到同一个 PostgreSQL 的应用程序。他们的测试似乎通过了:https://app.circleci.com/pipelines/github/typeorm/typeorm/1319/workflows/cf7bf4d0-5c6f-485f-803b-64eff385676b/jobs/2012
还有什么想法可以尝试或可能发生什么?
【问题讨论】:
-
您是否尝试过使用
postgres驱动程序的其他测试?他们都失败了吗?顺便说一句,github.com/typeorm/typeorm/blob/… 有一个有趣的评论:todo(AlexMesser): check why tests are failing under postgres driver让你流连忘返。 -
我将失败的测试注释掉,其他测试也以同样的方式失败。
标签: typeorm