CI for Node.js
Build, lint, and test a Node.js web application using npm, ESLint, Jest, and Cypress.
Use template →1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
steps: - label: ":npm: Install dependencies" key: "deps" command: npm install plugins: - artifacts#v1.9.3: upload: "node_modules" compressed: node_modules.tgz - docker#v5.9.0: image: "node:20.11" - label: ":eslint: Run ESLint" command: "npx eslint" depends_on: "deps" plugins: - artifacts#v1.9.3: download: "node_modules" compressed: node_modules.tgz - docker#v5.9.0: image: "node:20.11" - label: ":jest: Run unit tests" depends_on: "deps" command: "npx jest" plugins: - artifacts#v1.9.3: download: "node_modules" compressed: node_modules.tgz - docker#v5.9.0: image: "node:20.11" - label: ":cypress: Run cypress tests" depends_on: "deps" commands: - npm install - npm start & npx --yes wait-on http://localhost:8000 - npx cypress run plugins: - docker#v5.9.0: image: cypress/browsers:node18.12.0-chrome106-ff106 options: --user 1001 volumes: - /workdir/node_modules
- Languages
- JavaScript
- Use cases
- Continuous integration, Web application
- Platforms
- Docker
CI for Node.js
Build, lint, and test a Node.js web application using npm, ESLint, Jest, and Cypress.
Use template →CI for Node.js
This template gives you a continuous integration (CI) pipeline that builds, lints, and end-to-end tests a Node.js application.
At a glance:
- For Node.js apps
- Uses npm
- Requires Docker
- Lints code with ESLint
- Runs Jest unit tests
- Runs Cypress integration tests
How it works
This template:
- Installs Node.js dependencies using npm, caching the result.
- Performs static analysis on the codebase with ESLint.
- Runs Jest unit tests.
- Starts the web app using
npm start
on port8000
, then runs any Cypress tests using their official Docker image. It useswait-on
to verify the app is ready for testing.
All steps run in serial, with each depending on the previous step to complete before starting. The runtime environment uses a Docker image with the latest version of Node.
Next steps
After you select Use template, you’ll:
- Connect the Git repository for your Node.js app.
- Check the commands match your scripts in
package.json
. - Configure the compute—run locally, on-premises, or in the cloud.
- Run the pipeline.
You can then play around with the pipeline settings. For example, run the pipeline locally while you iterate on the definition or set a schedule to trigger a nightly build.
If you need help, please check our documentation, raise an issue , or reach out to support.