gpt4 book ai didi

intellij-idea - 运行单个 Mocha 测试不适用于 IntelliJ 和 Typescript

转载 作者:行者123 更新时间:2023-12-02 04:34:48 26 4
gpt4 key购买 nike

我为 IntelliJ 安装了 NodeJS 插件并运行所有 mocha 测试。

当我尝试运行单个套件时,Mocha 会为我生成如下配置:

/usr/local/bin/node /usr/local/lib/node_modules/mocha/bin/_mocha \
--timeout 15000 \
--compilers ts:ts-node/register \
--ui bdd \
--reporter "/Users/Bersling/Library/Application Support/IntelliJIdea2017.1/NodeJS/js/mocha-intellij/lib/mochaIntellijReporter.js" \
/Users/Bersling/Desktop/IT-Projects/typescript-mongo-express-angular-node-seed/backend/src/router/endpoints/login-router.test.ts \
--grep "LoginRouter "

但是,这对我不起作用。我得到了应该工作正常的测试错误。这是日志的一部分。

error:  Error: Internal Server Error
at Test.Request.callback (/Users/Bersling/Desktop/IT-Projects/typescript-mongo-express-angular-node-seed/backend/node_modules/superagent/lib/node/index.js:626:17)
at IncomingMessage.<anonymous> (/Users/Bersling/Desktop/IT-Projects/typescript-mongo-express-angular-node-seed/backend/node_modules/superagent/lib/node/index.js:795:18)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
(node:90972) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): AssertionError: false == true
Error: Unknown authentication strategy "local"
at attempt (/Users/Bersling/Desktop/IT-Projects/typescript-mongo-express-angular-node-seed/backend/node_modules/passport/lib/middleware/authenticate.js:173:37)

以下是可行的:

/usr/local/bin/node /usr/local/lib/node_modules/mocha/bin/_mocha \
--timeout 15000 \
--compilers ts:ts-node/register \
--ui bdd \
--reporter "/Users/Bersling/Library/Application Support/IntelliJIdea2017.1/NodeJS/js/mocha-intellij/lib/mochaIntellijReporter.js" \
**/*.test.ts \
--grep "LoginRouter "

像这样测试运行正常。

有谁知道如何让它运行?

最佳答案

今天我遇到了同样的错误。尝试将 mocha 重新安装到另一个版本,然后返回以前的版本。这对我有用。

关于intellij-idea - 运行单个 Mocha 测试不适用于 IntelliJ 和 Typescript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44476354/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com