name: Tests on: push: branches: [main] pull_request: jobs: test-features: name: test-features.mjs (smoke) runs-on: ubuntu-latest strategy: matrix: node-version: ['20', '24'] fail-fast: false steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Node ${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - name: Detect package-lock id: detect_lock shell: bash run: | if [ -f package-lock.json ]; then DEPS="$(node -p "Object.keys(require('./package.json').dependencies || {}).length")" if [ "$DEPS" -gt 0 ]; then echo "needs_install=true" >> $GITHUB_OUTPUT else echo "needs_install=false" >> $GITHUB_OUTPUT fi else echo "needs_install=false" >> $GITHUB_OUTPUT fi - name: npm install (if dependencies present) if: steps.detect_lock.outputs.needs_install == 'true' run: npm ci - name: Run npm test shell: bash run: | # Bootstrap tolerance: if test-features.mjs does not exist yet (Phase 0 # ships before Phase 1 lands the test harness), skip with a notice. # The `npm test` script is configured in package.json from day one, so # checking script presence is not a useful gate — the file must exist. if [ ! -f test-features.mjs ]; then echo "::notice::test-features.mjs not present yet (Phase 0 bootstrap phase). Skipping. Test harness lands with Phase 1 per docs/adr/0001 / spec §6." exit 0 fi npm test