language: node_js
sudo: false
cache:
  directories:
    - node_modules

jobs:
  include:
    - stage: "tests"
      name: "Run eslint"
      script: "npm install -g eslint@4; npm run eslint;"
      node_js: "10"
    - name: "TypeScript 2.9 generation and compilation tests"
      node_js: "10"
      script:
        - npm install -g typescript@2.9;
        - pushd test/unit/typescript/
        - tsc -p .
        - node -e "require('./api-generation-test').generate()" > generated.ts
        - tsc generated.ts
    - name: "Unit tests - Node.js 12"
      node_js: "12"
      script: "npm test"
    - name: "Unit tests w/ latest dependencies - Node.js 12"
      node_js: "12"
      script:
        - rm package-lock.json
        - rm -rf node_modules
        - npm install
        - npm test
    - name: "Unit tests - Node.js 10"
      node_js: "10"
      script: "npm test"
    - name: "Unit tests - Node.js 8"
      node_js: "8"
      script: "npm test"
    - name: "TypeScript (latest) generation and compilation tests"
      node_js: "10"
      script:
        - npm install -g typescript;
        - pushd test/unit/typescript/
        - tsc -p .
        - node -e "require('./api-generation-test').generate()" > generated.ts
        - tsc generated.ts
