Is it possible to ensure that the build preparation is also passed into all subsequent stages and jobs (node environment path + node_modules), without manually running it at the start of each job?
stages:
- stage: Build
jobs:
- job: BuildJob
steps:
- task: NodeTool@0
inputs:
versionSpec: '24.x'
displayName: 'Install Node.js'
- script: npm ci
displayName: 'Install node modules'
- stage: Checks
dependsOn:
- Build
jobs:
- job: CheckLintJob
steps:
- script: npm run lint
displayName: 'Run linter'
- job: CheckFormatJob
steps:
- script: npm run format:check
displayName: 'Run prettier check'
- job: CheckTestJob
steps:
- script: npm run test
displayName: 'Run tests'
Or do I need to group up the stages and jobs, and just run 5 sequential steps (and lose the modularity)?
steps:
- task: NodeTool@0
inputs:
versionSpec: '24.x'
displayName: 'Install Node.js'
- script: npm ci
displayName: 'Install node modules'
- script: npm run lint
displayName: 'Run linter'
- script: npm run format:check
displayName: 'Run prettier check'
- script: npm run test
displayName: 'Run tests'