Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
809c488
add new smoke test for cloudflare + vite
ibolmo Jan 15, 2026
1a5f0b3
add vite dev test
ibolmo Jan 15, 2026
257e639
revert
ibolmo Jan 16, 2026
d5a0d9c
split smoke jobs
ibolmo Jan 16, 2026
b2f2f03
make sure to run the npm run test:vitest-dev always
ibolmo Jan 16, 2026
c99e945
add multiple cloudflare tests and change bundling for the browser build
cpinn Jan 15, 2026
0e3026b
remove support in nextjs
cpinn Jan 15, 2026
0e8dc7b
updates
cpinn Jan 16, 2026
5f77bc6
add full matrix of compatibility
cpinn Jan 16, 2026
c63ff07
ensure all 4 environments are checked
cpinn Jan 16, 2026
f4f105b
add back proper error, undo browser test changes
cpinn Jan 16, 2026
0c5f091
modifications to run deno mjs and deno browser
cpinn Jan 16, 2026
8d2e5e2
initial isomorph commit
cpinn Jan 16, 2026
7da0b6f
fix nunjucks prompt tests and add a bit of cleanup
cpinn Jan 16, 2026
91f012d
only include configure node in the test that needs it
cpinn Jan 16, 2026
9159c37
refactor cloudflare worker tests and add more information on the test…
cpinn Jan 16, 2026
07135b3
modify vite react hono cloudflare test to use braintrust/browser
cpinn Jan 16, 2026
bb23716
modify isomorph configuration, cleanup
cpinn Jan 16, 2026
c418c77
allow error to be thrown for vite-react-hono
cpinn Jan 16, 2026
a8b7824
fix the type errors
cpinn Jan 16, 2026
ae41133
fix missing node: prefix, require eslint node: prefix, and update tsu…
ibolmo Jan 16, 2026
6d2287c
tweak prepare to use turbo
ibolmo Jan 16, 2026
3477596
nest deno browser and deno node under deno
cpinn Jan 16, 2026
fa95170
still requiring some node modules in deno node, fix cloudflare packag…
cpinn Jan 16, 2026
369434d
small workflow update, deno update
cpinn Jan 17, 2026
1539428
remove all the node modules in the node deno file
cpinn Jan 17, 2026
24392f7
mark a few packages as noexternal to be easier for deno
cpinn Jan 17, 2026
bc25fda
add simplifications to the deno flow
cpinn Jan 17, 2026
6233f9c
remove no-external
cpinn Jan 20, 2026
9108e84
remove browser templates
cpinn Jan 20, 2026
9ec8e9d
Smoke v2 (#1283)
ibolmo Jan 20, 2026
8f578db
Merge branch 'main' into caitlin/externalize
cpinn Jan 20, 2026
04ebd69
add a recent compatibility date
cpinn Jan 20, 2026
51afb78
remove the additional no external
cpinn Jan 20, 2026
ea95479
Revert "add a recent compatibility date"
cpinn Jan 21, 2026
4d03120
Merge branch 'main' into caitlin/externalize
cpinn Jan 21, 2026
7180b69
try to fix deno
ibolmo Jan 21, 2026
0247412
avoid deno install
ibolmo Jan 21, 2026
5f5dc16
try removing deno lock
ibolmo Jan 21, 2026
c42ed80
fix deno-browserg
ibolmo Jan 21, 2026
0c31a02
Merge branch 'main' into caitlin/externalize
cpinn Jan 21, 2026
fa88223
Modify package json exports for browser environments (#1295)
cpinn Jan 22, 2026
a8072d6
Robust-er smoke tests (#1299)
ibolmo Jan 23, 2026
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
388 changes: 50 additions & 338 deletions .github/workflows/js.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repos:
)$
args:
- "-L"
- "rouge,coo,couldn,unsecure,ontext,afterall"
- "rouge,coo,couldn,unsecure,ontext,afterall,als"
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.3.2
hooks:
Expand Down
36 changes: 14 additions & 22 deletions js/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ help:
@echo " make test-ai-sdk-v6 - Run AI SDK v6 wrapper tests"
@echo " make test-claude-agent-sdk - Run Claude Agent SDK wrapper tests"
@echo " make test-api-compat - Run API compatibility tests"
@echo " make test-smoke - Run smoke tests"
@echo " make bench - Run queue performance benchmarks"
@echo " make test-latest - Run core + latest versions of wrappers"
@echo ""
@echo "Smoke tests (mimics CI workflow):"
@echo " make test-smoke - Run all smoke tests (auto-prepares)"
@echo " make test-smoke deno - Run deno smoke test only"
@echo " make test-smoke span - Run span smoke test only"
@echo ""
@echo "See smoke/README.md for details on smoke test infrastructure"

.PHONY: help bench build clean test test-core test-openai test-anthropic test-google-genai test-ai-sdk test-ai-sdk-v5 test-ai-sdk-v6 test-claude-agent-sdk test-latest install-optional-deps publish-beta-local test-smoke

Expand Down Expand Up @@ -155,33 +161,19 @@ clean:
# Smoke tests
# -------------------------------------------------------------------------------------------------

# Marker file to track when smoke tests were last prepared
SMOKE_PREPARE_MARKER := smoke/.prepare-marker
SMOKE_DIR := smoke

# Run smoke tests (prepares if source changed)
# Run smoke tests (always prepares - relies on turbo/tsup caching for build efficiency)
# Usage: make test-smoke [TEST_NAME...]
test-smoke:
@if [ ! -f "$(SMOKE_PREPARE_MARKER)" ]; then \
echo "⚠ Smoke tests not prepared, preparing..."; \
cd $(SMOKE_DIR) && ./prepare-tests.sh && touch .prepare-marker; \
elif [ -n "$$(find src -type f \( -name '*.ts' -o -name '*.tsx' \) -newer "$(SMOKE_PREPARE_MARKER)" 2>/dev/null | head -1)" ]; then \
echo "⚠ SDK source files changed, preparing smoke tests..."; \
cd $(SMOKE_DIR) && ./prepare-tests.sh && touch .prepare-marker; \
elif [ -n "$$(find dist -type f -name '*.js' -newer "$(SMOKE_PREPARE_MARKER)" 2>/dev/null | head -1)" ]; then \
echo "⚠ SDK build artifacts changed, preparing smoke tests..."; \
cd $(SMOKE_DIR) && ./prepare-tests.sh && touch .prepare-marker; \
elif [ ! -d "artifacts" ] || [ -z "$$(ls artifacts/*.tgz 2>/dev/null | head -1)" ]; then \
echo "⚠ Smoke test artifacts missing, preparing..."; \
cd $(SMOKE_DIR) && ./prepare-tests.sh && touch .prepare-marker; \
else \
echo "✓ Smoke tests are up to date"; \
fi
@echo "Running smoke tests..."
@EXIT_CODE=0; \
cd $(SMOKE_DIR) && ./run-tests.sh $(filter-out test-smoke,$(MAKECMDGOALS)) || EXIT_CODE=$$?; \
@TESTS="$(filter-out test-smoke,$(MAKECMDGOALS))"; \
SMOKE_ABS="$$(pwd)/$(SMOKE_DIR)"; \
cd $(SMOKE_DIR) && ./prepare-tests.sh $$TESTS; \
EXIT_CODE=0; \
cd $$SMOKE_ABS && ./run-tests.sh $$TESTS || EXIT_CODE=$$?; \
echo ""; \
echo "Restoring package files..."; \
cd $$SMOKE_ABS && \
for dir in tests/*/; do \
if [ -f "$$dir/package.json" ] && grep -q '"restore"' "$$dir/package.json" 2>/dev/null; then \
(cd "$$dir" && npm run restore >/dev/null 2>&1 && echo " ✓ Restored $$(basename $$dir)") || true; \
Expand Down
5 changes: 5 additions & 0 deletions js/eslint.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import tseslint from "@typescript-eslint/eslint-plugin";
import tsparser from "@typescript-eslint/parser";
import nodeImport from "eslint-plugin-node-import";
import tsupConfigImport from "./tsup.config";

// Handle both ESM and CJS module formats
Expand Down Expand Up @@ -30,6 +31,7 @@ export default [
},
plugins: {
"@typescript-eslint": tseslint,
"node-import": nodeImport,
},
rules: {
// Base TypeScript rules
Expand All @@ -54,6 +56,9 @@ export default [
],
"no-unused-expressions": ["error", { allowShortCircuit: true }],
"@typescript-eslint/no-unused-expressions": "off",
// Require node: protocol for Node.js built-in imports (for Deno compatibility)
// This plugin automatically detects ALL Node.js built-ins - no manual list needed!
"node-import/prefer-node-protocol": "error",
},
},
{
Expand Down
19 changes: 17 additions & 2 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,28 @@
"./package.json": "./package.json",
".": {
"types": "./dist/index.d.ts",
"edge-light": "./dist/browser.mjs",
"workerd": "./dist/browser.mjs",
"node": {
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"browser": "./dist/browser.mjs",
"import": "./dist/index.mjs",
"module": "./dist/index.mjs",
"require": "./dist/index.js"
"require": "./dist/index.js",
"default": "./dist/browser.mjs"
},
"./browser": {
"import": "./dist/browser.mjs",
"module": "./dist/browser.mjs",
"require": "./dist/browser.js"
},
"./node": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"module": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./dev": {
"types": "./dev/dist/index.d.ts",
"import": "./dev/dist/index.mjs",
Expand Down Expand Up @@ -99,6 +112,8 @@
"async": "^3.2.5",
"autoevals": "^0.0.131",
"cross-env": "^7.0.3",
"eslint-plugin-node-import": "^1.0.5",
"jiti": "^2.6.1",
"npm-run-all": "^4.1.5",
"openapi-zod-client": "^1.18.3",
"prettier": "^3.5.3",
Expand Down
1 change: 0 additions & 1 deletion js/smoke/.gitignore

This file was deleted.

137 changes: 137 additions & 0 deletions js/smoke/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# Auto-discover scenarios (any folder in scenarios/ with a Makefile)
SCENARIOS := $(shell find scenarios -mindepth 1 -maxdepth 1 -type d -exec test -f {}/Makefile \; -print | sed 's|scenarios/||' | sort)

.PHONY: help setup test list clean

# =============================================================================
# Help
# =============================================================================

help:
@echo "Smoke Test Infrastructure"
@echo ""
@echo "Available targets:"
@echo " make test - Run all scenarios (builds SDK once if needed)"
@echo " make test <scenario> - Run specific scenario (e.g., make test otel-v1)"
@echo " make setup - Ensure SDK artifacts + shared package are ready"
@echo " make clean - Remove all build artifacts (force rebuild)"
@echo " make list - List discovered scenarios"
@echo ""
@echo "Environment variables:"
@echo " BRAINTRUST_TAR - Path to braintrust tarball (auto-set by parent when running locally)"
@echo " BRAINTRUST_OTEL_TAR - Path to otel tarball (auto-set by parent when running locally)"
@echo " SMOKE_V2_SHARED_DIST - Path to shared package dist (auto-set by parent when running locally)"
@echo ""
@echo "Running individual scenarios:"
@echo " cd scenarios/otel-v1 && make test - Runs standalone, builds if needed"
@echo ""
@echo "Discovered scenarios:"
@for scenario in $(SCENARIOS); do echo " - $$scenario"; done

# =============================================================================
# Setup - Build SDK + shared package
# =============================================================================

setup:
@echo "==> Setting up smoke"
@mkdir -p ../artifacts

@# Build SDK and create tarball if not provided
@if [ -n "$(BRAINTRUST_TAR)" ] && [ -f "$(BRAINTRUST_TAR)" ]; then \
echo "==> Using provided BRAINTRUST_TAR: $(BRAINTRUST_TAR)"; \
else \
echo "==> Building SDK and creating tarball"; \
cd ../../.. && pnpm exec turbo build --filter=braintrust && pnpm --filter=braintrust pack --pack-destination sdk/js/artifacts; \
\
for f in sdk/js/artifacts/braintrust-*.tgz; do \
if [ "$$(basename $$f)" != "braintrust-latest.tgz" ] && \
[ "$$(basename $$f)" != "braintrust-otel-latest.tgz" ]; then \
cp "$$f" sdk/js/artifacts/braintrust-latest.tgz; \
break; \
fi; \
done; \
fi

@# Build shared package if not provided
@if [ -n "$(SMOKE_V2_SHARED_DIST)" ] && [ -d "$(SMOKE_V2_SHARED_DIST)" ]; then \
echo "==> Using provided SMOKE_V2_SHARED_DIST: $(SMOKE_V2_SHARED_DIST)"; \
else \
if [ ! -d shared/dist ]; then \
echo "==> Building shared package"; \
cd shared && npm ci && npm run build; \
else \
echo "==> Shared package already built"; \
fi; \
fi

# =============================================================================
# Clean - Remove all build artifacts
# =============================================================================

clean:
@echo "==> Cleaning smoke artifacts"
rm -rf ../artifacts/*.tgz
rm -rf shared/dist shared/node_modules

# =============================================================================
# Test - Run scenarios
# =============================================================================

test:
@REQUESTED="$(filter-out test,$(MAKECMDGOALS))"; \
\
if [ -z "$$REQUESTED" ]; then \
SCENARIOS_TO_RUN="$(SCENARIOS)"; \
echo "==> Running all scenarios"; \
else \
SCENARIOS_TO_RUN=""; \
for scenario in $$REQUESTED; do \
if [ ! -d "scenarios/$$scenario" ]; then \
echo "Error: Scenario '$$scenario' not found"; \
echo "Available scenarios:"; \
for s in $(SCENARIOS); do echo " - $$s"; done; \
exit 1; \
fi; \
SCENARIOS_TO_RUN="$$SCENARIOS_TO_RUN $$scenario"; \
done; \
echo "==> Running scenarios:$$SCENARIOS_TO_RUN"; \
fi; \
\
$(MAKE) setup; \
\
: $${BRAINTRUST_TAR:=../artifacts/braintrust-latest.tgz}; \
: $${BRAINTRUST_OTEL_TAR:=../artifacts/braintrust-otel-latest.tgz}; \
: $${SMOKE_V2_SHARED_DIST:=shared/dist}; \
export BRAINTRUST_TAR BRAINTRUST_OTEL_TAR SMOKE_V2_SHARED_DIST; \
\
FAILED_SCENARIOS=""; \
for scenario in $$SCENARIOS_TO_RUN; do \
echo ""; \
echo "=== Testing $$scenario ==="; \
if ! $(MAKE) -C scenarios/$$scenario test; then \
FAILED_SCENARIOS="$$FAILED_SCENARIOS $$scenario"; \
fi; \
done; \
\
echo ""; \
if [ -n "$$FAILED_SCENARIOS" ]; then \
echo "✗ Failed scenarios:$$FAILED_SCENARIOS"; \
exit 1; \
else \
echo "✓ All requested scenarios passed"; \
fi

# =============================================================================
# List - Show discovered scenarios
# =============================================================================

list:
@echo "Discovered scenarios:"
@for scenario in $(SCENARIOS); do echo " - $$scenario"; done

# =============================================================================
# Make scenario names valid targets (no-ops to support "make test otel-v1")
# =============================================================================

$(SCENARIOS):
@:
Loading
Loading