"Not an nREPL dict" 使用 cider-auto-test-mode

"Not an nREPL dict" using cider-auto-test-mode

我正在尝试 运行 使用 CIDER 的 cider-auto-test-mode 在 Emacs/CIDER 中测试我的命名空间。然而,每当我加载命名空间时,我都会收到错误 Not an nREPL dict。关于如何解决这个问题或进一步调试它有什么建议吗?

在描述我目前的发现之前:我正在使用 CIDER 0.12.0、cider-nrepl 版本 0.10.0 和 nREPL 0.2.12。我知道 CIDER/cider-nrepl 版本差异不好;这不是我选择的,但如果它是这个问题的原因,我可以修复它。

在 CIDER Github issue, and a follow-up humane-test-output issue 上讨论了同样的错误消息。我在使用的构建过程中没有发现任何可能涉及 humane-test-output.

我第一次加载文件 (C-c C-k)、测试 运行 并且我得到以下堆栈跟踪:

error("Not an nREPL dict")
nrepl-dict-map( #[...]  ((dict "context" "my `testing` comment" ...)))
nrepl-dict-map( #[...] (dict "my-deftest-name" ((dict "context" "my `testing` comment" ...))))
cider-test-highlight-problems((dict "my-deftest-name" ((dict "context" "my `testing` comment" ...))))
nrepl--dispatch-response(...)

当我 toggle-debug-on-error 已经加载文件后,测试不再 运行 我得到这个堆栈跟踪:

error("Not an nREPL dict")
nrepl-dict-keys(((dict "context" "my `testing` comment" ...)))
nrepl-dict-map(#[...] (dict "my-deftest-name" ((dict "context" "my `testing` comment" ...))
cider-test-clear-highlights()
cider-test-execute(...)
cider-test-run-ns-tests(...)
cider--test-silently()

堆栈跟踪略有不同,但问题相同:dict 列表 is not a valid nREPL dict. While cider-test-highlight-problems clearly expects and is getting a namespace and vars in the outer dict list, instead of receiving a dict list of dict lists as apparently expected 的列表,而是接收 dict 列表的简单列表,如我的堆栈跟踪所示。

关于我如何进一步研究或解决这个问题的任何建议?

首先要检查的是 CIDER 与 cider-nrepl 版本差异。

过去的情况是,您必须将 cider-nrepl 放入 ~/.lein/profile.clj 的依赖项部分,然后将 fiddle 与版本一起放入,直到错误消失。

你不再需要这样做,它会导致很多问题出现这样的症状。这些天 当你 运行 cider-jack-in 时,cider 提供了它自己的依赖项 所以最常见的解决方案是 从你的 lein 配置文件中删除 cider 并让它自动选择正确的 cider-nrepl 版本。

这可能不是这里的问题,但至少对于后来发现类似症状的任何人来说,解决这个问题是一件好事。