Skip to content

Commit e682015

Browse files
authored
Merge pull request #1 from logtide-dev/feature/integration-test-apps
feat: add integration tests for various frameworks and update configurations
2 parents 79e3534 + 53c0904 commit e682015

File tree

91 files changed

+14461
-3840
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+14461
-3840
lines changed

.github/workflows/ci.yml

Lines changed: 86 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ jobs:
7575
run: pnpm typecheck
7676

7777
# ====================
78-
# Tests
78+
# Unit Tests
7979
# ====================
8080
test:
81-
name: Tests
81+
name: Unit Tests
8282
runs-on: ubuntu-latest
8383
needs: [build]
8484

@@ -103,5 +103,88 @@ jobs:
103103
- name: Build packages (needed for workspace references)
104104
run: pnpm build
105105

106-
- name: Run tests
106+
- name: Run unit tests
107107
run: pnpm test
108+
109+
# ====================
110+
# Smoke Tests (Vitest)
111+
# ====================
112+
smoke-tests:
113+
name: Smoke Tests
114+
runs-on: ubuntu-latest
115+
needs: [build]
116+
117+
steps:
118+
- name: Checkout
119+
uses: actions/checkout@v4
120+
121+
- name: Setup pnpm
122+
uses: pnpm/action-setup@v4
123+
with:
124+
version: ${{ env.PNPM_VERSION }}
125+
126+
- name: Setup Node.js
127+
uses: actions/setup-node@v4
128+
with:
129+
node-version: ${{ env.NODE_VERSION }}
130+
cache: 'pnpm'
131+
132+
- name: Install dependencies
133+
run: pnpm install --frozen-lockfile
134+
135+
- name: Build packages (needed for workspace references)
136+
run: pnpm build
137+
138+
- name: Run smoke tests (Hono, Elysia, Express, Fastify)
139+
run: pnpm test:smoke
140+
141+
# ====================
142+
# E2E Tests (Playwright)
143+
# ====================
144+
e2e-tests:
145+
name: E2E Tests (${{ matrix.app }})
146+
runs-on: ubuntu-latest
147+
needs: [build, smoke-tests]
148+
strategy:
149+
fail-fast: false
150+
matrix:
151+
app: [nextjs, sveltekit, nuxt, angular]
152+
153+
steps:
154+
- name: Checkout
155+
uses: actions/checkout@v4
156+
157+
- name: Setup pnpm
158+
uses: pnpm/action-setup@v4
159+
with:
160+
version: ${{ env.PNPM_VERSION }}
161+
162+
- name: Setup Node.js
163+
uses: actions/setup-node@v4
164+
with:
165+
node-version: ${{ env.NODE_VERSION }}
166+
cache: 'pnpm'
167+
168+
- name: Install dependencies
169+
run: pnpm install --frozen-lockfile
170+
171+
- name: Build packages (needed for workspace references)
172+
run: pnpm build
173+
174+
- name: Install Playwright browsers
175+
run: npx playwright install --with-deps chromium
176+
working-directory: test-apps/${{ matrix.app }}
177+
178+
- name: Run E2E tests
179+
run: pnpm test
180+
working-directory: test-apps/${{ matrix.app }}
181+
env:
182+
CI: 'true'
183+
184+
- name: Upload Playwright report
185+
uses: actions/upload-artifact@v4
186+
if: failure()
187+
with:
188+
name: playwright-report-${{ matrix.app }}
189+
path: test-apps/${{ matrix.app }}/playwright-report/
190+
retention-days: 7

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ coverage/
4040
.temp/
4141
tmp/
4242

43+
# Framework build output
44+
.next/
45+
.nuxt/
46+
.output/
47+
.angular/
48+
49+
# Auto-generated
50+
next-env.d.ts
51+
4352
# Claude
4453
.claude/
4554
tmpclaude*

CHANGELOG.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.5.5] - 2026-02-07
9+
10+
### Added
11+
12+
#### Monorepo Structure
13+
- Restructured as pnpm monorepo with 11 packages under `packages/*`
14+
- Unified versioning across all packages (0.5.5)
15+
- Version bump script (`pnpm version:set <version>`)
16+
17+
#### Core (`@logtide/core`)
18+
- `LogtideClient` — capture logs, errors, breadcrumbs, and spans
19+
- `Hub` — global singleton for convenient access
20+
- `Scope` — per-request context isolation with tags, extras, and breadcrumbs
21+
- `SpanManager` — distributed tracing with W3C Trace Context (`traceparent`)
22+
- `BatchTransport` — automatic batching with retry logic and circuit breaker
23+
- `LogtideHttpTransport` and `OtlpHttpTransport` for log and span delivery
24+
- `ConsoleIntegration` — intercepts console methods, records breadcrumbs
25+
- `GlobalErrorIntegration` — captures unhandled rejections and uncaught exceptions
26+
- DSN parsing, error serialization, trace ID generation
27+
28+
#### Types (`@logtide/types`)
29+
- Shared TypeScript interfaces: `LogEntry`, `Span`, `Breadcrumb`, `Transport`, `Integration`, `ClientOptions`
30+
31+
#### Express (`@logtide/express`)
32+
- Express middleware for automatic request tracing, error capture, breadcrumbs
33+
- W3C Trace Context propagation (`traceparent` in/out)
34+
- Scope accessible via `req.logtideScope`
35+
- Express 4 and 5 support
36+
37+
#### Fastify (`@logtide/fastify`)
38+
- Fastify plugin with `onRequest`, `onResponse`, `onError` lifecycle hooks
39+
- Automatic request spans, error capture, `traceparent` propagation
40+
- Scope accessible via `request.logtideScope`
41+
- Fastify 4 and 5 support, wrapped with `fastify-plugin`
42+
43+
#### Node.js SDK (`@logtide/sdk-node`) — Legacy
44+
- Standalone Node.js client with batching, retry, circuit breaker, query API, live streaming
45+
- Express middleware and Fastify plugin for auto-logging HTTP requests
46+
- Marked as legacy — use `@logtide/express` or `@logtide/fastify` instead
47+
48+
#### Next.js (`@logtide/nextjs`)
49+
- Server-side: `registerLogtide()` for `instrumentation.ts`, `captureRequestError` for `onRequestError`
50+
- Client-side: `initLogtide()`, `trackNavigation()` for SPA breadcrumbs
51+
- `instrumentRequest()` / `finishRequest()` for manual request tracing
52+
- App Router and Pages Router support
53+
54+
#### Nuxt (`@logtide/nuxt`)
55+
- Nuxt 3 module with zero-config setup via `nuxt.config.ts`
56+
- Nitro server plugin: request tracing, error capture via lifecycle hooks
57+
- Vue client plugin: `errorHandler`, navigation breadcrumbs
58+
- Runtime config injection (server + public)
59+
60+
#### SvelteKit (`@logtide/sveltekit`)
61+
- `logtideHandle()` — request spans, trace context propagation, scope in `event.locals`
62+
- `logtideHandleError()` — unexpected error capture
63+
- `logtideHandleFetch()``traceparent` propagation on server-side fetches
64+
- `initLogtide()` for client-side error handling
65+
66+
#### Hono (`@logtide/hono`)
67+
- Middleware for automatic request tracing, error capture, breadcrumbs
68+
- Scope accessible via `c.get('logtideScope')`
69+
- Works on Node.js, Bun, Deno, Cloudflare Workers
70+
71+
#### Angular (`@logtide/angular`)
72+
- `LogtideErrorHandler` — captures all uncaught Angular errors
73+
- `LogtideHttpInterceptor` — traces outgoing HTTP, injects `traceparent`, captures HTTP errors
74+
- `provideLogtide()` for standalone apps (Angular 17+)
75+
- `getLogtideProviders()` for NgModule-based apps
76+
77+
#### Elysia (`@logtide/elysia`)
78+
- Plugin with `onRequest`, `onAfterHandle`, `onError` lifecycle hooks
79+
- Automatic request spans, error capture, `traceparent` propagation
80+
- Registered as global plugin (`.as('global')`)
81+
82+
#### CI/CD
83+
- GitHub Actions CI: build, typecheck, test on push/PR to `main`/`develop`
84+
- GitHub Actions publish: npm publish on tag `v*.*.*`, GitHub Release, or manual dispatch
85+
- Publish order: types → core → all framework packages
86+
- Branch model: `develop``main`, hotfix directly to `main`
87+
88+
#### Documentation
89+
- README for every package with badges, quick start, API reference
90+
- Root README with package table, architecture diagram, development guide
91+
- Branch protection documentation (`.github/BRANCH_PROTECTION.md`)
92+
93+
[0.5.5]: https://github.com/logtide-dev/logtide-javascript/releases/tag/v0.5.5

CODE_OF_CONDUCT.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Code of Conduct
2+
3+
## Our Pledge
4+
5+
We are committed to providing a welcoming and inclusive environment for everyone, regardless of background or identity.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to a positive environment:
10+
11+
- Being respectful and inclusive
12+
- Accepting constructive criticism gracefully
13+
- Focusing on what is best for the community
14+
- Showing empathy towards others
15+
16+
Examples of unacceptable behavior:
17+
18+
- Harassment, trolling, or insulting comments
19+
- Personal or political attacks
20+
- Publishing others' private information without permission
21+
- Other conduct that would be inappropriate in a professional setting
22+
23+
## Enforcement
24+
25+
Project maintainers have the right to remove, edit, or reject comments, commits, code, issues, and other contributions that are not aligned with this Code of Conduct.
26+
27+
## Reporting
28+
29+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at **support@logtide.dev**.
30+
31+
All complaints will be reviewed and investigated promptly and fairly.
32+
33+
## Attribution
34+
35+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.1.

CONTRIBUTING.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Contributing to LogTide JavaScript SDK
2+
3+
Thank you for your interest in contributing!
4+
5+
## Development Setup
6+
7+
1. Clone the repository:
8+
```bash
9+
git clone https://github.com/logtide-dev/logtide-javascript.git
10+
cd logtide-javascript
11+
```
12+
13+
2. Install dependencies:
14+
```bash
15+
pnpm install
16+
```
17+
18+
3. Build all packages:
19+
```bash
20+
pnpm build
21+
```
22+
23+
## Project Structure
24+
25+
This is a pnpm monorepo. All packages live under `packages/`:
26+
27+
- `types` — Shared TypeScript type definitions
28+
- `core` — Core client, hub, transports, and utilities
29+
- `express` — Express middleware
30+
- `fastify` — Fastify plugin
31+
- `nextjs` — Next.js integration
32+
- `nuxt` — Nuxt 3 module
33+
- `sveltekit` — SvelteKit hooks
34+
- `hono` — Hono middleware
35+
- `angular` — Angular integration
36+
- `elysia` — Elysia plugin
37+
- `node` — Legacy standalone Node.js SDK
38+
39+
## Code Style
40+
41+
- Follow [TypeScript Best Practices](https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html)
42+
- Use strict TypeScript with no implicit any
43+
- Use meaningful variable and function names
44+
- Add JSDoc comments for public APIs
45+
46+
## Testing
47+
48+
```bash
49+
# Run all tests
50+
pnpm test
51+
52+
# Run tests for a specific package
53+
pnpm -r --filter @logtide/express test
54+
55+
# Type checking
56+
pnpm typecheck
57+
58+
# Build all packages
59+
pnpm build
60+
```
61+
62+
## Pull Request Process
63+
64+
1. Fork the repository
65+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
66+
3. Make your changes
67+
4. Ensure tests pass (`pnpm test`)
68+
5. Ensure type checking passes (`pnpm typecheck`)
69+
6. Commit your changes (`git commit -m 'Add amazing feature'`)
70+
7. Push to the branch (`git push origin feature/amazing-feature`)
71+
8. Open a Pull Request
72+
73+
## Reporting Issues
74+
75+
- Use the GitHub issue tracker
76+
- Provide clear description and reproduction steps
77+
- Include Node.js version and OS information
78+
- Include relevant logs and error messages
79+
80+
## Questions?
81+
82+
Feel free to open an issue for any questions or discussions!

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 LogTide
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)