简体   繁体   中英

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

I have a Node.js project as a GitHub repo. There are currently no tests written for the project. My goal is to simply build the project successfully with Travis-CI, without any tests.

I'm currently using the following basic Travis config, .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. It appears to be failing, as no tests have been written. How could I build/install on Travis without checking for tests?

npm test is the default build script for nodejs projects.

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:

script: 'true'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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