yesod测试 - 缺少依赖性yesod-test

时间:2013-12-22 02:22:58

标签: haskell cabal yesod

我使用yesod init命令设置了一个yesod scaffolded站点,并命名了我的项目yesodtry。我继续使用此命令设置了一个脚手架网站,该命令由yesod init

提供
cd yesodtry && cabal sandbox init && cabal install && yesod devel

一切顺利,我在127.0.0.1:3000访问了演示网站。出于好奇,我试着尝试yesod test命令。这是我得到的输出:

Resolving dependencies...
Configuring yesodtry-0.0.0...
cabal: At least the following dependencies are missing:
hspec -any, yesod-test ==1.2.*

看到yesodtry.cabal文件如何有test部分,我尝试执行cabal build test,这是输出:

cabal: Cannot build the test suite 'test' because test suites are not enabled.
Run configure with the flag --enable-tests

好的......所以它告诉我运行cabal configure --enable-tests。这是输出:

Resolving dependencies...
Configuring yesodtry-0.0.0...
cabal: At least the following dependencies are missing:
hspec -any, yesod-test ==1.2.*

我在yesodtry.cabal中看到这一行,build-depends“部分的test-suite test”:

yesod-test >= 1.2 && < 1.3

似乎cabal没有在这里安装依赖项。我该怎么做?

谢谢。

1 个答案:

答案 0 :(得分:2)

好的,我想我找到了Haskell-cafe thread的答案。

我们必须这样做:

cabal configure --enable-tests
cabal install --only-dependencies --enable-tests

将安装test-suite test部分的依赖项。

然后我跑了yesod test,这是输出的最后几行:

Linking dist/build/test/test ...
Building yesodtry-0.0.0...
Preprocessing library yesodtry-0.0.0...
In-place registering yesodtry-0.0.0...
Preprocessing test suite 'test' for yesodtry-0.0.0...
Linking dist/build/test/test ...
Running 1 test suites...
Test suite test: RUNNING...
Test suite test: PASS
Test suite logged to: dist/test/yesodtry-0.0.0-test.log
1 of 1 test suites (1 of 1 test cases) passed.

希望这将有助于将来遇到同样问题的任何人。