简体   繁体   English

如何配置 Travis CI 以在没有测试的情况下构建 Node.js?

[英]How to configure Travis CI to build Node.js without tests?

I have a Node.js project as a GitHub repo.我有一个 Node.js 项目作为 GitHub 存储库。 There are currently no tests written for the project.目前没有为该项目编写测试。 My goal is to simply build the project successfully with Travis-CI, without any tests.我的目标是简单地使用 Travis-CI 成功构建项目,无需任何测试。

I'm currently using the following basic Travis config, .travis.yml :我目前正在使用以下基本 Travis 配置.travis.yml

language: node_js
node_js:
  - "node"

install:
  - npm install

The above will fail for me, with the following output:以上对我来说将失败,输出如下:

[0Ktravis_fold:end:nvm.install
[0K$ node --version
v9.11.1
$ npm --version
5.6.0
$ nvm --version
0.33.8
travis_fold:start:install
[0Ktravis_time:start:154792e9
[0K$ npm install
[37;40mnpm[0m [0m[30;43mWARN[0m[35m[0m repoName@1.0.0 No repository field.
[0m
up to date in 0.599s

[0Ktravis_fold:end:install
[0Ktravis_time:start:3e0b4d3c
[0K$ npm test

> repoName@1.0.0 test /home/travis/build/githubHandle/repoName.js
> echo "Error: no test specified" && exit 1

Error: no test specified
[37;40mnpm[0m [0m[31;40mERR![0m[35m[0m Test failed.  See above for more details.
[0m

I don't understand why npm test is being run.我不明白为什么要运行npm test It appears to be failing, as no tests have been written.它似乎失败了,因为没有编写测试。 How could I build/install on Travis without checking for tests?如何在检查测试的情况下在 Travis 上构建/安装?

npm test is the default build script for nodejs projects. npm test是 nodejs 项目的默认构建脚本

If you haven't unit tests or build task, you can skip this step.如果你没有单元测试或构建任务,你可以跳过这一步。 To do that, add the following line in your travis config file:为此,请在您的 travis 配置文件中添加以下行:

script: 'true'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM