1

在查看 bower.json 时,我认为将东西放入devDependencies是处理诸如单元测试依赖项之类的推荐方法。我想使用qunit作为我的测试框架,但我想它也应该适用于其他框架。

我遇到的问题是,当我将 qunit 放入 devDependencies 时,它在构建时不会被拾取vendor.js。这是意料之中的,但是我该如何要求早午餐包括它呢?显然,我更喜欢test-vendor.js有依赖项 + devDependencies 的地方,同时将 devDependencies 排除在vendor.js.

我有这个config.coffee

exports.config =
  # See http://brunch.readthedocs.org/en/latest/config.html for documentation.
  files:
    javascripts:
      joinTo:
        'javascripts/app.js': /^app/
        'javascripts/vendor.js': /^(bower_components|vendor)/
        'test/javascripts/test.js': /^test\/(?!vendor)/
        'test/javascripts/test-vendor.js': /^test\/(?=vendor)/

显然,最后一行不会按原样拾取任何 bower_component 项目。这里有什么建议吗?

我看到了这张票:

但它看起来仍然悬而未决。

这个 SOq:

表明目前无法从凉亭一侧做到这一点。

4

2 回答 2

1

直到这在早午餐中本地实现之前,只要您不使用 Windows,您就可以像这样破解它:

  1. 将 quint 和其他测试依赖项添加到 bower.json 中的 devDependencies。它们现在将在 bower_components 下进行管理。
  2. 将您的 test/ 目录中的每个测试依赖项的符号链接添加到 bower_components 下的相关文件,例如:

ln -s ../bower_components/qunit/qunit.js test/

然后,依赖项将包含在您的 unit-tests.js 中。

当 brunch 支持 devDependencies 时,您可以删除符号链接。

于 2013-11-18T06:01:49.553 回答
0

请参阅早午餐生产构建中的忽略目录

您应该能够执行以下操作:

overrides:
  production:
    conventions:
      ignored: /[\/\\]_|bower_components[\/\\]qunit/

brunch b -P然后使用( brunch build --production)生成您的生产版本

于 2013-11-12T14:15:19.020 回答