Note npm ci is now the default npm install mechanism instead of npm install
Since npm ci strictly adheres to the dependencies list on package-lock.json, it removes node_modules that may be installed using package.json before it begins its own installs. This way the cached modules and npm commands from the old cache location node_modules won't work. Therefore, travis will throw an error complaining "cannot find /node_modules/.bin/npm" after running npm ci.
There are two solutions to this problem:
Fully transition to npm ci, and keep the npm cache at new location to speed up installs
cache:
directories:
- "$HOME/.npm"
Specify to use old install, and continue to use the old cache location
According to doc and some benchmark tests, npm ci is introduced to ensure proper build with package-lock.json and have build time twice faster than npm install, boosting your Travis build speed.
See here docs.npmjs.com/cli/ci
Hello, thanks for the great post, but I have a question. On the index.spec.js file you imported the server file i.e const server = require('../index');
but it appears 'server' wasn't used anywhere. Why did you import it please and can it be omitted since it's not used. Thanks
She didn't use server variable because she was just writing a demo test case, comparing two identical strings (which would definitely always pass)
expect('ci with travis').to.equal('ci with travis')
In the real world she'd rather be doing something in the lines of inspecting that server variable to see if server was actually successfully created at specified port.
Thx for this! This is really what I wanted. Helped A LOT.
Can I translate in Korean this article? If you don't mind, I wanna share this awesome information in Korean. Surely, There will be a link directing to this original one.
Thanks for your prompt response. I created .travis.yml in the root directory of my project, added the language, integrated my github account with travis, saved my changes locally and push to github, nothing happens, I could see my commit messages from travis site but no build process. Thank you.
Great tutorial and very helpful blog post, although it would have been nice to add a note on the "mocha --exit" change you made on Github to get Travis CI to pass.
Note
npm ciis now the default npm install mechanism instead ofnpm installSince
npm cistrictly adheres to the dependencies list onpackage-lock.json, it removesnode_modulesthat may be installed usingpackage.jsonbefore it begins its own installs. This way the cached modules and npm commands from the old cache locationnode_moduleswon't work. Therefore, travis will throw an error complaining "cannot find /node_modules/.bin/npm" after runningnpm ci.There are two solutions to this problem:
npm ci, and keep the npm cache at new location to speed up installsAccording to doc and some benchmark tests,
npm ciis introduced to ensure proper build withpackage-lock.jsonand have build time twice faster thannpm install, boosting your Travis build speed.See here docs.npmjs.com/cli/ci
Great article!
I'm comfortable doing CI for Java projects, but I've never done any CI for Nodejs.
How would you do CI for Nodejs apps with no tests?
Would you say running
npm ciis enough?Thanks for any ideas
Travis is also good for SSG.
epsi-rns.gitlab.io/devops/2020/02/...
Hello, thanks for the great post, but I have a question. On the index.spec.js file you imported the server file i.e
const server = require('../index');
but it appears 'server' wasn't used anywhere. Why did you import it please and can it be omitted since it's not used. Thanks
She didn't use server variable because she was just writing a demo test case, comparing two identical strings (which would definitely always pass)
expect('ci with travis').to.equal('ci with travis')
In the real world she'd rather be doing something in the lines of inspecting that server variable to see if server was actually successfully created at specified port.
Thx for this! This is really what I wanted. Helped A LOT.
Can I translate in Korean this article? If you don't mind, I wanna share this awesome information in Korean. Surely, There will be a link directing to this original one.
Very helpful, Please can you elaborate on how to add the passing build label on the Readme or the TravisCI dashboard
Hey I hope this link is helpful docs.travis-ci.com/user/status-ima.... You have to copy the badge from Travis and add it to your README.md.
not quite clear, at least for a beginner like me. did the steps above and nothing shows up on travis
What part is not clear? What did you try and also what's the error you are getting?
Thanks for your prompt response. I created .travis.yml in the root directory of my project, added the language, integrated my github account with travis, saved my changes locally and push to github, nothing happens, I could see my commit messages from travis site but no build process. Thank you.
If you followed the steps it should work. Try adding a script command to the travis.yml file like so:
So it can trigger your test script.
Add this to the main article to make it complete. This line is the missing ingredient.
Great tutorial, Thank you so much!
Hi , you can add syntax highlighting for your code examples :
github.com/adam-p/markdown-here/wi...
:)
Thanks dallgoot will do.
Great tutorial and very helpful blog post, although it would have been nice to add a note on the "mocha --exit" change you made on Github to get Travis CI to pass.
Thanks! Sure will update the article.
Thank you
Great tutorial, thank you!