早午餐/凉亭测试

时间:2013-11-07 04:11:44

标签: bower brunch

在查看bower.json时,我假设在devDependencies中放置内容是处理单元测试依赖项等事情的推荐方法。我想使用qunit作为我的测试框架,但我想它也应该适用于其他框架。

我遇到的问题是当我在devDependencies中放入qunit时,在构建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:

表示目前没有办法从凉亭方面做到这一点。

2 个答案:

答案 0 :(得分:1)

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

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

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

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

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

答案 1 :(得分:0)

请参阅Ignore directories in brunch production build

您应该可以执行以下操作:

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

然后使用brunch b -Pbrunch build --production

生成您的生产版本