2.13 Nodejs application testing example

You can run the tests for a Nodejs application.

Pipeline Configuration

---
resources:
- name: repo
  type: git
  icon: github
  source:
    uri: https://github.com/nodejs/nodejs.org.git

- name: node-image
  type: registry-image
  source:
    repository: node
    tag: 13.10.1-stretch

jobs:
- name: test
  public: true
  plan:
  - get: node-image
  - get: repo
    trigger: true
  - task: install
    image: node-image
    config:
      inputs:
      - name: repo
      outputs:
      - name: dependencies
        path: repo/node_modules
      platform: linux
      run:
        path: npm
        args: ["install"]
        dir: repo
  - task: test
    image: node-image
    config:
      inputs:
      - name: repo
      - name: dependencies
        path: repo/node_modules
      platform: linux
      run:
        path: npm
        args: ["run", "test"]
        dir: repo

References