Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 47 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq

- name: Enable Corepack
run: corepack enable

Expand Down Expand Up @@ -154,21 +151,54 @@ jobs:
- name: Build SDK
run: pnpm run build

- name: Install test dependencies
- name: Run integration tests
run: pnpm run test:integration

e2e-tests:
if: github.event_name == 'workflow_dispatch'
name: E2E Tests (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: ["24.x"]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Enable Corepack
run: corepack enable

- name: Setup pnpm
run: |
for dir in tests/*/; do
if [ -f "$dir/bb.test.json" ]; then
echo "Installing dependencies for $(basename $dir)..."
(cd "$dir" && pnpm install --frozen-lockfile)
fi
done

- name: Make test scripts executable
run: chmod +x tests/*.sh

- name: Run all integration tests
working-directory: tests
corepack prepare pnpm@10.12.1 --activate
pnpm config set store-dir ~/.pnpm-store

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-${{ matrix.node-version }}-

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run e2e tests
env:
BROWSERBASE_API_KEY: ${{ secrets.BB_INTEGRATION_TEST_API_KEY }}
BROWSERBASE_PROJECT_ID: ${{ secrets.BB_INTEGRATION_TEST_PROJECT_ID }}
run: ./run-all-tests.sh
run: pnpm run test:e2e
12 changes: 4 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
node_modules/
dist/
dist-test/
dist-integration-test/
.browserbase/

.env
Expand All @@ -21,11 +22,6 @@ test-ignore.txt
.gitignore.test-marker
test-gitignore-dir/

# Test artifacts
tests/*/.browserbase/
tests/*/dev-server.log
tests/*/dev-response.json
tests/*/publish-output.log
tests/*/test.log
tests/*/.env.test
tests/*/test-ignore.txt
# Pack output
*.tgz

9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"./dist/index.js"
],
"scripts": {
"build": "$npm_execpath run lint && rm -rf dist && tsup",
"build": "rm -rf dist && tsup",
"build:tests": "tsc --project tsconfig.test.json",
"eslint": "eslint ./src",
"eslint:fix": "eslint --fix ./src",
Expand All @@ -32,6 +32,13 @@
"prettier:fix": "prettier . --write --cache",
"test": "$npm_execpath build:tests && node --test dist-test/**/*.test.js",
"test:only": "$npm_execpath build:tests && node --test-only --test dist-test/**/*.test.js",
"build:integration": "tsc --project tsconfig.integration.json",
"pretest:integration": "$npm_execpath run build && pnpm pack",
"test:integration": "$npm_execpath run build:integration && node --test --test-timeout 120000 dist-integration-test/tests/integration/**/*.test.js",
"posttest:integration": "rm -f browserbasehq-sdk-functions-*.tgz",
"pretest:e2e": "$npm_execpath run build && pnpm pack",
"test:e2e": "$npm_execpath run build:integration && node --test --test-timeout 300000 dist-integration-test/tests/e2e/**/*.test.js",
"posttest:e2e": "rm -f browserbasehq-sdk-functions-*.tgz",
"typecheck": "tsc --noEmit"
},
"keywords": [],
Expand Down
4 changes: 0 additions & 4 deletions tests/basic/bb.test.json

This file was deleted.

4 changes: 0 additions & 4 deletions tests/basic/expected/basic.json

This file was deleted.

Loading