【问题标题】:yesod test - missing dependency yesod-testyesod 测试 - 缺少依赖项 yesod-test
【发布时间】:2014-08-04 16:45:05
【问题描述】:

我正在使用yesod init 命令设置一个yesod 脚手架站点,并将我的项目命名为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 中看到这一行,用于test-suite test“部分”的build-depends:

yesod-test >= 1.2 && < 1.3

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

谢谢。

【问题讨论】:

    标签: haskell cabal yesod


    【解决方案1】:

    好的,我想我在 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.
    

    希望这对以后遇到同样问题的人有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-10-26
      • 1970-01-01
      • 2012-07-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-20
      相关资源
      最近更新 更多