diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50caff538..449c4778f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,3 +65,36 @@ jobs: - name: Run tests run: ./scripts/test + + ecosystem_tests: + name: ecosystem tests (v${{ matrix.node-version }}) + runs-on: ubuntu-latest + if: github.repository == 'openai/openai-node' + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + node-version: ['18', '20'] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: '${{ matrix.node-version }}' + + - uses: denoland/setup-deno@v1 + with: + deno-version: v1.39.0 + + - uses: oven-sh/setup-bun@v2 + + - name: Bootstrap + run: ./scripts/bootstrap + + - name: Run ecosystem tests + run: | + yarn tsn ecosystem-tests/cli.ts --live --verbose --parallel --jobs=4 --retry=3 + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} diff --git a/src/lib/EventStream.ts b/src/lib/EventStream.ts index d3f485e9d..d1b1cc8d3 100644 --- a/src/lib/EventStream.ts +++ b/src/lib/EventStream.ts @@ -1,3 +1,4 @@ +import { isAbortError } from '../internal/errors'; import { APIUserAbortError, OpenAIError } from '../error'; export class EventStream { @@ -145,7 +146,7 @@ export class EventStream { #handleError(this: EventStream, error: unknown) { this.#errored = true; - if (error instanceof Error && error.name === 'AbortError') { + if (isAbortError(error)) { error = new APIUserAbortError(); } if (error instanceof APIUserAbortError) {