从“rake cucumber”中删除有关 ansicon 的警告

发布于 2024-11-28 17:53:02 字数 345 浏览 0 评论 0原文

当您在未安装 ANSICON 的计算机上运行安装了 Cucumber 的任何 rake 任务时,您会收到以下消息:

*** WARNING: You must use ANSICON 1.31 or higher (http://adoxa.110mb.com/ansicon) to get coloured output on Windows

When running local I like using ANSICON, but when using inside the build server I don't care about that - 并且我不想在那里看到那个警告。有办法摆脱它吗?

When you run any rake task with cucumber installed on a machine that doesn't have ANSICON installed, you get the following message:

*** WARNING: You must use ANSICON 1.31 or higher (http://adoxa.110mb.com/ansicon) to get coloured output on Windows

When running locally I like using ANSICON, but when used within the build server I don't care about that - and I don't want to see that warning there. Is there a way to get rid of it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

浅唱ヾ落雨殇 2024-12-05 17:53:02

您实际上可以删除警告本身。我不喜欢为了一个绿字而安装一堆垃圾。因此,要删除警告:

1. 在 gems 目录中找到 Cucumber 安装(位于 Ruby 安装目录中)。对我来说是: lib\ruby\gems\1.9.1\gems\cucumber-1.2.0

2. 在 Cucumber 安装的 cucumber-1.2.0\lib\cucumber\formatter 目录中找到文件 ansicolor.rb

3. 找到以下行:

STDERR.puts %{*** 警告:您必须使用 ANSICON 1.31 或更高版本 (http://adoxa.110mb.com/ansicon) 才能在 Windows 上获得彩色输出}

并在其前面添加 # 将其注释掉:

# STDERR.puts %{*** 警告:您必须使用 ANSICON 1.31 或更高版本 (http://adoxa.110mb.com/ansicon) 才能在 Windows 上获得彩色输出}

行号为 14对于我的黄瓜版本。

4.保存文件即可完成

You can actually remove the warning itself. I do not like installing a bunch of garbage just for the sake of having a green word. So, to remove the warning:

1. Locate the Cucumber installation in gems directory (it's in the Ruby installation directory). For me it was: lib\ruby\gems\1.9.1\gems\cucumber-1.2.0

2. In the cucumber-1.2.0\lib\cucumber\formatter directory of the Cucumber installation find the file ansicolor.rb

3. Locate the line:

STDERR.puts %{*** WARNING: You must use ANSICON 1.31 or higher (http://adoxa.110mb.com/ansicon) to get coloured output on Windows}

and add # in front of it to comment it out:

# STDERR.puts %{*** WARNING: You must use ANSICON 1.31 or higher (http://adoxa.110mb.com/ansicon) to get coloured output on Windows}

The line number was 14 for my version of Cucumber.

4. Save the file and you're done

扶醉桌前 2024-12-05 17:53:02
  1. http://adoxa.altervista.org/ansicon/ 下载并解压文件,
  2. 打开 cmd 并导航到解压缩的文件夹
  3. 导航到 x64(如果您有 64 位计算机),否则导航到 x86
  4. 键入 ansicon.exe -h,您将获得此命令的帮助
  5. 执行'ansicon.exe -i' 安装 ansicon 并将其添加到您的 Windows
  6. 运行您的 cucumber 0.10.0 测试,您应该
    在 Windows 上获取彩色输出结果
  1. Download and unzip the file from http://adoxa.altervista.org/ansicon/
  2. open cmd and navigate to the unzipped folder
  3. Navigate to x64 (if you have a 64 bit machine) otherwise navigate to x86
  4. Type ansicon.exe -h and you will get help of this command
  5. Execute 'ansicon.exe -i' to install and add ansicon to your Windows
  6. Run your cucumber 0.10.0 test and you should
    get the coloured output result on Windows
木有鱼丸 2024-12-05 17:53:02

你能为你的spec_helper.rb添加一个例外吗?或者尝试添加一个在使用 rake 时过滤的标签?

Can you add an exception to you spec_helper.rb? Or perhaps try adding a tag which you filter on when using rake?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文