UserALE.js Build and Test

To build and test Apache Flagon UserALE.js, clone the apache/flagon monorepo and ensure you have Node.js (>= 20.x) and pnpm (>= 10.x) installed (or run nix develop at the repository root).

git clone https://github.com/apache/flagon.git
cd flagon/products/userale

# Install workspace dependencies
pnpm install

Build

UserALE.js is written in TypeScript and bundled with tsup (producing both ES module build/main.mjs and script-tag IIFE build/main.global.js bundles alongside TypeScript declarations build/main.d.ts), while the browser extension (flagon-userale-ext) is built with Plasmo.

# Build all workspace packages (flagon-userale and flagon-userale-ext)
pnpm build

# Or build only flagon-userale
pnpm --dir packages/flagon-userale build

If you modify proto/apache/flagon/userale/v1/log.proto, regenerate the TypeScript Protobuf contract definitions from the repository root:

buf lint
buf generate

Test

UserALE.js uses Jest (with jsdom and @bufbuild/protobuf contract tests) for unit testing and Playwright for end-to-end browser and extension testing.

Run Unit & Schema Contract Tests (Jest)

pnpm --dir packages/flagon-userale test

Example output:

PASS test/spec/auth.spec.ts
PASS test/spec/headers.spec.ts
PASS test/spec/getInitialSettings.spec.ts
PASS test/spec/configure.spec.ts
PASS test/spec/attachHandlers.spec.ts
PASS test/spec/sendLogs.spec.ts
PASS test/spec/exporters.spec.ts
PASS test/spec/packageLogs.spec.ts
PASS test/spec/replay.spec.ts
PASS test/spec/main.spec.ts

Test Suites: 10 passed, 10 total
Tests:       1 skipped, 111 passed, 112 total

Run End-to-End Tests (Playwright)

From products/userale:

pnpm test

Code Formatting & Linting

pnpm format        # Format source/test files with Prettier
pnpm format:check  # Check formatting (used in CI)
pnpm lint          # Lint and auto-fix with ESLint
pnpm lint:check    # Lint without modifying files (used in CI)

Contributing

Contributions are welcome! See the Contributing Guide for more information.