问题描述
我正在为Atom制作一个包,Travis CI一直告诉我我的生成失败。
更新:我创建了一个空规范文件, 。
I'm making a package for Atom, and Travis CI keeps telling me my build failed.
Update: I created a blank spec file and now my builds are passing.
您可以在这里查看我的包裹:
You can see my package here: https://travis-ci.org/frayment/language-jazz
控制台告诉我:
sh: line 105: ./spec: No such file or directory
Missing spec folder! Please consider adding a test suite in
我在GitHub上查找Atom包并且他们似乎是基于CoffeeScript,但我不能理解它们包含什么。关于这个主题没有太多的文档,所以:
I went looking around at Atom packages on GitHub for 'spec' files and they seem to be CoffeeScript based, but I can't understand what on earth they contain. There isn't much documentation on the subject, so:
什么是'spec'文件,我放在什么?
帮助非常感谢。
推荐答案
./ spec
目录应包含一个或多个,例如,这个规范取自Atom文档:
The ./spec
directory should contain one or more Jasmine Specifications for the Atom Package you are developing, for example, this spec is taken from the Atom documentation:
describe "when a test is written", ->
it "has some expectations that should pass", ->
expect("apples").toEqual("apples")
expect("oranges").not.toEqual("apples")
开源软件面临的最大挑战之一是当大量个人贡献者提供代码时保持质量,一个解决方案是提供:
One of the biggest challenges with Open Source software is maintaining quality when a large number of individual contributors are providing code, one solution to this is providing a high level of test coverage:
在Atom的情况下,所有规范都添加到 ./ spec
文件夹中,并且必须以 -spec.coffee
,因此例如如果您创建了一个名为 awesome
的包,并且您的代码位于 /awesome.coffee
那么你的规格将是 ./ spec / awesome.coffee
。您的规范应该运用代码的关键领域,以便在提交到您的主分支。
In Atom's case, all of the specifications are added to the ./spec
folder and must end with -spec.coffee
, so for example if you were creating a package named awesome
and your code sat within /awesome.coffee
then you spec would be ./spec/awesome.coffee
. Your spec should exercise the key areas of your code to give you confidence when committing pull requests to your master branch.
我有一个的在Atom.io上,并且这两个测试都包含它们,欢迎您使用这些作为Jasmine 1.3测试如何编写以支持您的软件包的功能的具体示例。同样,Atom.io上的大多数包也有一组测试,您可以借助它们构建自己的测试套件。
I have a couple of packages on Atom.io and both of these have tests included with them, you are welcome to use these as concrete examples of how Jasmine 1.3 tests can be written to support the functionality of your packages. Equally the majority of packages on Atom.io also have a set of tests that you can draw upon to build your own test suite.
这篇关于Atom的'spec'文件如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!