Skip to content

test: test sendMessageStream fallback to sendMessage in e2e.spec.ts #1149

test: test sendMessageStream fallback to sendMessage in e2e.spec.ts

test: test sendMessageStream fallback to sendMessage in e2e.spec.ts #1149

Workflow file for this run

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Run Unit Tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
paths-ignore:
- '**.md'
- 'LICENSE'
- '.github/CODEOWNERS'
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
node-version: [18, 20, 22, 24]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- run: npm ci
- run: npm test
# Edge runtime tests use @edge-runtime/vm to emulate Cloudflare Workers,
# Vercel Edge Functions, and similar environments. This ensures the SDK
# works correctly in non-Node.js server environments.
test-edge:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- run: npm ci
- run: npm run test:edge
# The vitest 4.0.x test coverage integration doesn't support Node 18,
# Node 18 has reached EOL already, however for compatibility we're still going to run tests
# for Node 18 until the next major release (see https://github.com/a2aproject/a2a-js/pull/256).
# Run coverage only once on a modern node to generate a report to avoid downgrading vitest.
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: 24
- name: Checkout Main
uses: actions/checkout@v4
with:
ref: main
- name: Install & Test (Main)
timeout-minutes: 10
run: |
npm ci
npm run coverage
mv coverage/coverage-summary.json ${{ runner.temp }}/coverage-main-summary.json
- name: Upload Artifact (main)
uses: actions/upload-artifact@v4
if: github.event_name != 'pull_request'
with:
name: coverage-report
path: coverage
retention-days: 14
- name: Checkout PR Branch
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
clean: true
- name: Install & Test (PR)
if: github.event_name == 'pull_request'
timeout-minutes: 10
run: |
npm ci
npm run coverage
mv coverage/coverage-summary.json coverage-pr-summary.json
mv ${{ runner.temp }}/coverage-main-summary.json coverage-main-summary.json
- name: Save PR number
run: |
echo ${{ github.event.number }} > ./PR_NUMBER
- name: Upload Coverage Artifacts
uses: actions/upload-artifact@v4
if: github.event_name == 'pull_request'
with:
name: coverage-data
path: |
coverage-main-summary.json
coverage-pr-summary.json
coverage/
PR_NUMBER
retention-days: 1